Repository navigation
Revert "fix(modal): Contain render errors within the dialog" - #129728
Closed
sentry-junior[bot] wants to merge 3 commits into
Closed
sentry-junior[bot] wants to merge 3 commits into
sentry-junior[bot] wants to merge 3 commits into
Conversation
This reverts commit a976243 (#129199). Keying the modal's ErrorBoundary on an incrementing modalId remounts the whole modal subtree on every openModal call. OrganizationContextProvider calls openSudo from an effect whenever a superuser hits a 403 on the org bootstrap. On mount, SudoModal refetches the errored bootstrap queries, each 403 produces a new error object, the effect calls openSudo again, and the modal remounts. Superuser elevation on a customer-domain org loops forever and the sudo modal never gets past its loading state. Co-Authored-By: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
Renders OrganizationContextProvider with the real sudo modal and a superuser whose org bootstrap requests 403. Fails if the modal never reaches the password form or the org request is refetched in a loop. Co-Authored-By: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
Contributor
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-4ny6rzrmq.sentry.dev |
The registry is emitted in TypeScript program file order, which shifts with the modal imports removed by the revert. Only the position of account-emails.email changes.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reverts #129199 (cc @TkDodo for context).
What breaks
Since #129199 shipped, a Sentry employee who opens a customer-domain org page without an active superuser session gets stuck in an infinite loop. The page keeps refetching the org bootstrap requests and
/api/0/authenticators/, and the sudo modal spinner never resolves, so they can't elevate.Why
#129199 added an incrementing
modalIdtoModalStoreand renders the modal content inside<ErrorBoundary key={modalId}>. EveryopenModalcall now remounts the whole modal subtree. Before, a secondopenModalwith the same component type reconciled in place.OrganizationContextProvidercallsopenSudofrom an effect on[user, error, organization]wheneveruser.isSuperuser && error.status === 403. That interacts badly with the remount:openSudo→SudoModalmounts.SudoModalsubscribes to the bootstrap org/teams/projects queries, which refetch because they errored.OrganizationStore→ the effect re-runs →openSudo→modalIdincrements →SudoModalremounts → go to 2.SudoModalwaits for the bootstrap queries to settle before it fetches authenticators, so it never gets past the loading state.Evidence
GET /organizations/{orgSlug}/ 403 … You do not have permission) jumped from about 8 per session to about 118k lines from 23 employees, starting at about 12:56 UTC on 2026-11-03, shortly after fix(modal): Contain render errors within the dialog #129199 merged at 12:09 UTC. That's roughly 1000× baseline.{"detail": "You do not have permission to perform this action."}) on/organizations/org-slug/,/teams/and/projects/, renderingOrganizationContextProvider+GlobalModalwith the real sudo modal, then waiting 2s:Changes
git revert a976243287050cb02bb60520bc4818370ed3567d. It applies cleanly and restores the 5 files touched by fix(modal): Contain render errors within the dialog #129199 to their exact pre-fix(modal): Contain render errors within the dialog #129199 contents. Nothing else readsmodalId.static/app/views/organizationContextSudo.spec.tsx, a small regression test for the scenario above without the sleep. It waits for the password field and asserts the org request ran at most 3 times. It needs its own file becauseorganizationContext.spec.tsxmocksopenSudo. It fails on master (the password field never appears) and passes on this branch, about 3s per run and 3/3 stable locally.Re-landing #129199
Either of these should let the error containment come back without the loop:
ErrorBoundarywhen it's actually showing an error (reset it on a newmodalIdwithout changingkey), so a normal re-open still reconciles in place.OrganizationContextProviderskipopenSudowhile a sudo modal is already open, so repeated 403s don't re-open it.Ideally, the re-land keeps the regression test from this PR.
Verification
jestoncore/modal/index.spec.tsx,errorBoundary.spec.tsx,modals/sudoModal.spec.tsx,views/organizationContext.spec.tsx,views/organizationContextSudo.spec.tsx: 5 suites, 38 tests passed. There is nomodalStorespec.pnpm run typecheck: passedpnpm run lint:jsandoxfmt --checkon touched files: cleanvia @lcian.
--
View Session [Sentry]