feat(cmd-k): Add DSN lookup to both command palettes#108401
feat(cmd-k): Add DSN lookup to both command palettes#108401
Conversation
Add DSN lookup functionality to both the new supercharged command palette and the legacy search modal. Users can paste a DSN and get quick navigation to the corresponding project. Depends on backend PR #108400.
…ared code
- Use correct org-scoped API URL `/organizations/{slug}/dsn-lookup/`
- Reset `isLoading` to false in early-return branch to prevent stuck loading state
- Extract shared `DSN_PATTERN` and `DsnLookupResponse` to `dsnLookupUtils.ts`
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| import useOrganization from 'sentry/utils/useOrganization'; | ||
|
|
||
| export function useDsnLookupActions(query: string): CommandPaletteActionWithKey[] { | ||
| const organization = useOrganization(); |
There was a problem hiding this comment.
useDsnLookupActions crashes when organization context is null
High Severity
content.tsx calls useOrganization({allowNull: true}) and defensively null-checks with optional chaining, indicating the organization context can be null. However, useDsnLookupActions is always invoked (hooks can't be conditional), and it internally calls useOrganization() without allowNull, which throws when the organization context is missing. The empty-string guard (hasDsnLookup ? query : '') doesn't prevent the crash because the hook body still runs useOrganization() before checking the query.


Summary
useDsnLookupActionshook)dsnLookupSource)Dependencies
Context
Split from #108396 — this is the frontend half.
Test plan
CI=true pnpm test useDsnLookupActions)