Skip to content

Commit

Permalink
fix(tsc): Correct null error in orgAuthTokenNote (#7746)
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser authored Sep 6, 2023
1 parent 4f91919 commit fe38163
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/orgAuthTokenNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ export function OrgAuthTokenNote() {
}

export function useOrgAuthTokenUrl() {
const {codeKeywords, sharedKeywordSelection} = useContext(CodeContext);
const [sharedSelection] = sharedKeywordSelection;
const context = useContext(CodeContext);

// When not signed in, we use a redirect URL that uses the last org the user visited
if (!codeKeywords.USER) {
if (context === null || !context.codeKeywords.USER) {
return 'https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/';
}

const choices = codeKeywords?.PROJECT;
const [sharedSelection] = context.sharedKeywordSelection;

const choices = context.codeKeywords?.PROJECT;
const currentSelectionIdx = sharedSelection.PROJECT ?? 0;
const currentSelection = choices[currentSelectionIdx];

Expand Down

0 comments on commit fe38163

Please sign in to comment.