-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(settings): Migrate configure integration from deprecatedRouteProps #103128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@sentry review |
| const tabParam = decodeScalar(location.query.tab) as Tab | undefined; | ||
| const tab: Tab = tabParam && TABS.includes(tabParam) ? tabParam : 'repos'; | ||
| const {integrationId, providerKey} = useParams<{ | ||
| integrationId: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location.query.tab is being read and type-cast to Tab | undefined. However, after the cast, it's being validated against TABS.includes(tabParam). Consider using proper type narrowing to avoid potential issues. Currently, if decodeScalar returns undefined, the condition will short-circuit correctly, but making this more explicit would improve code clarity.
Severity: MEDIUM
💡 Suggested Fix
| const tabParam = decodeScalar(location.query.tab) as Tab | undefined; | |
| const tab: Tab = tabParam && TABS.includes(tabParam) ? tabParam : 'repos'; | |
| const {integrationId, providerKey} = useParams<{ | |
| integrationId: string; | |
| const tabParam = (decodeScalar(location.query.tab) ?? '') as Tab | undefined; | |
| const tab: Tab = (tabParam && TABS.includes(tabParam as Tab)) ? (tabParam as Tab) : 'repos'; |
Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2624811
| }) | ||
| ); | ||
| } | ||
| }, [router, organization, providerKey]); | ||
| }, [navigate, organization, providerKey]); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The component now uses navigate() from useNavigate() hook instead of router.push(). Ensure that all navigation calls are using the correct object format. At lines 145-149 and 164-167, navigate() is being called with location objects containing pathname and query properties. Verify that the navigate() function correctly handles the query property (as it's a React Router v6 pattern, which typically uses search parameters instead). This might need adjustment depending on how the router handles query strings.
Severity: MEDIUM
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location:
static/app/views/settings/organizationIntegrations/configureIntegration.tsx#L145-L149
Potential issue: The component now uses `navigate()` from `useNavigate()` hook instead
of `router.push()`. Ensure that all navigation calls are using the correct object
format. At lines 145-149 and 164-167, `navigate()` is being called with location objects
containing `pathname` and `query` properties. Verify that the `navigate()` function
correctly handles the `query` property (as it's a React Router v6 pattern, which
typically uses search parameters instead). This might need adjustment depending on how
the router handles query strings.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2624811
No description provided.