Skip to content

Conversation

@alexsohn1126
Copy link
Member

@alexsohn1126 alexsohn1126 commented Jan 2, 2026

Previously the console sdk access modal looked like this:

image

This would create a user feedback that will land in a slack channel, and that would need to be manually put into SaC repo.

This PR changes the modal to the following:

When user has no GitHub identity linked to their Sentry account:
image

When user has a GitHub identity linked to their Sentry account:
image

After inviting themselves into a repository:
image

See this video for what it would look like for the user:
https://github.com/user-attachments/assets/4a682e89-452e-446a-817a-8dcf9db6e781

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 2, 2026
…for-testing' into alexsohn/feat/add-request-console-sdk-access-button-component
@alexsohn1126 alexsohn1126 changed the title Alexsohn/feat/add request console sdk access button component feat(console): Add request console sdk access button Jan 5, 2026
@alexsohn1126 alexsohn1126 changed the title feat(console): Add request console sdk access button feat(console): Update request console sdk access modal and button Jan 5, 2026
@alexsohn1126 alexsohn1126 marked this pull request as ready for review January 5, 2026 22:08
@alexsohn1126 alexsohn1126 requested a review from a team as a code owner January 5, 2026 22:08
navigate(newPath, {replace: true});
openPrivateGamingSdkAccessModal(modalProps);
}
}, [location.search, location.pathname, navigate, modalProps]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unstable object reference causes repeated useEffect execution

The buttonProps object in RequestSdkAccessButton is created fresh on every render and passed to useReopenGamingSdkModal, where it's included in the useEffect dependency array as modalProps. Since the object reference changes on every render, the effect runs on every render. If the component re-renders while reopenGamingSdkModal=true is still in the URL (before the navigate call updates the location), the modal could be opened multiple times. This is especially problematic in React StrictMode where effects run twice. The modalProps object should be memoized using useMemo to ensure a stable reference.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is legit (kinda) -- the useEffect is really reactive to location.search changes, but since you delete the search param that would trigger the open modal, this doesn't matter.

I think to make it a bit clearer, you could either memoize the buttonProps for the caller or you can do remove modalProps from the dependency array by using a ref to save its latest value e.g.

const modalPropsRef = useRef(modalprops);
modalPropsRef.current = modalProps;

useEffect(() => {
...

openPrivateGamingSdkAccessModal(modalPropsRef.current);
...

@billyvg
Copy link
Member

billyvg commented Jan 6, 2026

@sentry review

@alexsohn1126 alexsohn1126 requested a review from a team January 6, 2026 19:12
const metadata = CONSOLE_PLATFORM_METADATA[platform];
return (
<li key={platform}>
<a href={metadata?.repoURL} target="_blank" rel="noopener noreferrer">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an ExternalLink component for this iirc.

Comment on lines +244 to +251
onClick={() => {
const separator = currentPath.includes('?') ? '&' : '?';
const pathWithReopenFlag = `${currentPath}${separator}reopenGamingSdkModal=true`;
window.location.href = `/identity/login/github/?next=${encodeURIComponent(pathWithReopenFlag)}`;
}}
>
{t('Log in with GitHub')}
</Button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is supposed to happen here when you click it, does it open in a new window or...?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will trigger the GitHub App authorization flow. It is essentially the same thing as log in with GitHub, and it will link a GitHub account with Sentry account.

The GitHub page will show up in the current window. See this video:
https://github.com/user-attachments/assets/4a682e89-452e-446a-817a-8dcf9db6e781

Comment on lines +119 to +120
setSubmittedPlatforms(successfulPlatforms);
setShowSuccessView(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be necessary (i'm not 100% sure), but I think you can use the result of useMutation for this instead of separate states.

e.g. if we have mutation = useMutation()... mutation.isSuccess == showSuccessView

Having the add*Message() in the handlers makes sense - but otherwise I think we can derive everything else from mutation?

Comment on lines +15 to +19
const searchParams = new URLSearchParams(location.search);
if (searchParams.get('reopenGamingSdkModal') === 'true') {
searchParams.delete('reopenGamingSdkModal');
const newSearch = searchParams.toString();
const newPath = location.pathname + (newSearch ? `?${newSearch}` : '');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would look into using nuqs here maybe

navigate(newPath, {replace: true});
openPrivateGamingSdkAccessModal(modalProps);
}
}, [location.search, location.pathname, navigate, modalProps]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is legit (kinda) -- the useEffect is really reactive to location.search changes, but since you delete the search param that would trigger the open modal, this doesn't matter.

I think to make it a bit clearer, you could either memoize the buttonProps for the caller or you can do remove modalProps from the dependency array by using a ref to save its latest value e.g.

const modalPropsRef = useRef(modalprops);
modalPropsRef.current = modalProps;

useEffect(() => {
...

openPrivateGamingSdkAccessModal(modalPropsRef.current);
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants