You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-05-28] [$250] 88633R2 - Domain - Not here page appears after resetting the domain #89258
DomainInitialPage is a persistent screen (always mounted as the sidebar in DomainSplitNavigator.tsx:29). When the domain goes null, it immediately re-renders FullPageNotFoundView with shouldShow={!domain || !isAdmin} — displaying "Hmm... it's not here" before navigation away finishes.
A useEffect in DomainInitialPage.tsx:109-115 also tries to goBack when domain becomes falsy, but the synchronous render of FullPageNotFoundView wins the race against the asynchronous effect.
Solution:
In DomainResetPage.tsx, call Navigation.goBack(ROUTES.WORKSPACES_LIST.route)beforeresetDomain() so the user navigates away before the optimistic Onyx update nullifies the domain data and triggers the NotFound view on the persistent DomainInitialPage.
User is on DomainResetPage (RHP) at route domain/:domainAccountID/admins/:accountID/reset-domain
User submits the reset form → handleResetDomain() fires
resetDomain() optimistically merges domain to null via Onyx — this is synchronous
DomainInitialPage (persistent sidebar, always mounted) re-renders: !domain is now true
FullPageNotFoundView renders with shouldShow=true → user sees "Not here" page
Navigation.goBack() from both DomainResetPage and DomainInitialPage's useEffect fire, but too late — the NotFound view already rendered
Alternative explanations considered:
Navigation itself could be failing — unlikely since the useEffect in DomainInitialPage also calls goBack as a fallback and users do eventually leave the page
The API could be failing and leaving the user stranded — unlikely since the issue is about the NotFound page flashing, not a permanent state, and the optimistic update is the trigger
Confidence: High — both researchers independently confirmed the same race condition with specific file:line evidence.
Related issues: Several other "Not here" page issues follow similar patterns where optimistic deletion triggers NotFound before navigation completes:
Expensify/App#83995 — Not here page after toggling keep me as admin and creating workspace
Expensify/App#85478 — Not here page after clicking "Pay via workspace" and navigating back
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
After a user resets a domain, the "Not here" (404) page is briefly shown before — or instead of — landing on the workspaces list page.
What is the root cause of that problem?
The problem is a race condition between two concurrent navigation actions triggered by the domain reset. In DomainResetPage.handleResetDomain, the code calls resetDomain(...) first and then immediately calls Navigation.goBack(ROUTES.WORKSPACES_LIST.route). The resetDomain action applies an optimistic update that sets the domain's Onyx entry to null synchronously. This triggers a re-render of DomainInitialPage, which is still mounted in the navigator stack. Its useEffect (line 109–115) evaluates domain as falsy and shouldShowFullScreenLoadingIndicator as false, so it also calls Navigation.goBack(ROUTES.WORKSPACES_LIST.route). Meanwhile, the FullPageNotFoundView in DomainInitialPage with shouldShow={!domain || !isAdmin} immediately becomes true and renders the "Not here" page because the domain was nullified. The result is that the user sees the not-found screen during the brief window between the optimistic update and the navigation completing.
What changes do you think we should make in order to solve the problem?
In DomainResetPage, the navigation should happen before calling resetDomain, not after. Swapping the order so that Navigation.navigate(ROUTES.WORKSPACES_LIST.route) (using navigate rather than goBack, since goBack depends on stack history) fires first takes the user off the domain screens before the optimistic Onyx update nullifies the domain data. This prevents DomainInitialPage from ever rendering the not-found state in response to the reset, since the page is no longer active in the foreground when the data changes.
Additionally, DomainInitialPage's redirect useEffect should also check whether the domain has a pending delete action (CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE on DOMAIN_PENDING_ACTIONS) and skip the goBack call in that case, so that even if the screen is still briefly in the navigator stack during a reset it does not redundantly fire a competing navigation. This guards against similar timing issues in other flows that might delete the domain.
changed the title [-]88633R2 - Domain - Not here page appears after resetting the domain[/-][+][$250] 88633R2 - Domain - Not here page appears after resetting the domain[/+]on Apr 30, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-04-30 10:20:12 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the only domain admin resets a domain, the app briefly navigates back into the deleted domain flow and shows a Not here page instead of returning to the workspaces list.
What is the root cause of that problem?
The regression is in src/pages/domain/DomainResetPage.tsx, in the access guard that was added to prevent opening the reset page when a domain has multiple admins.
That guard uses domainHasOnlyOneAdmin, which is derived from adminAccountIDsSelector(domain). In src/selectors/Domain.ts, adminAccountIDsSelector() returns [] when domain is null.
During resetDomain() in src/libs/actions/Domain.ts, the optimistic update immediately sets DOMAIN.${domainAccountID} to null. As soon as that happens:
adminAccountIDsSelector(null) returns []
domainHasOnlyOneAdmin flips to false
The effect treats the page as an invalid multi-admin state and calls Navigation.goBack(ROUTES.DOMAIN_ADMIN_DETAILS.getRoute(...))
That sends the user back to DomainAdminDetailsPage, which renders through BaseDomainMemberDetailsComponent into DomainNotFoundPageWrapper. Since the domain was just deleted, DomainNotFoundPageWrapper evaluates !domain as true and shows the Not here page.
So the deepest root cause is not the reset action itself. The problem is that the reset-page guard uses admin-count state as a proxy for access validity and does not distinguish between these two different cases:
the domain still exists and now has multiple admins
the domain has been deleted by the reset flow
Those states must not be handled the same way.
What changes do you think we should make in order to solve the problem?
Update the useEffect guard in src/pages/domain/DomainResetPage.tsx so it only redirects to DOMAIN_ADMIN_DETAILS when the domain still exists and the page has become invalid because there are now multiple admins.
Concretely:
Change the effect guard to return early when domain is null
Add domain to the dependency array because the redirect condition now depends on it
Leave handleResetDomain() as-is; its existing Navigation.goBack(ROUTES.WORKSPACES_LIST.route) is already the correct navigation after a successful reset
This is also consistent with the existing pattern in src/pages/domain/DomainInitialPage.tsx, which distinguishes a missing domain from a valid-but-inaccessible domain instead of routing deeper into deleted-domain screens.
What alternative solutions did you explore? (Optional)
Changing handleResetDomain() to use a different navigation call was rejected because the submit handler is already correct; the regression is the access guard firing after the optimistic delete.
Removing the effect entirely was rejected because it would re-open the original problem that the guard was added to solve: the reset page remaining accessible when the domain has more than one admin.
⚠️@KJ21-ENG Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
@ShridharGoel The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Contributor: @emkhalid paid $250 via Upwork
Contributor+: @ShridharGoel due $250 via NewDot
@emkhalid can you please accept the job below? Please reply here and tag me once you have.
If you're not sent an offer in Upwork when you're assigned to an issue, and an Upwork job exists, please submit a proposal. https://www.upwork.com/jobs/~022049794401741844689
Activity
MelvinBot commentedon Apr 30, 2026
Proposal
Root Cause:
When
resetDomain()is called fromDomainResetPage.tsx:60, it optimistically sets the domain Onyx data tonull(Domain.ts:777-779) beforeNavigation.goBack()on line 61 completes.DomainInitialPageis a persistent screen (always mounted as the sidebar inDomainSplitNavigator.tsx:29). When the domain goesnull, it immediately re-rendersFullPageNotFoundViewwithshouldShow={!domain || !isAdmin}— displaying "Hmm... it's not here" before navigation away finishes.A
useEffectinDomainInitialPage.tsx:109-115also tries togoBackwhen domain becomes falsy, but the synchronous render of FullPageNotFoundView wins the race against the asynchronous effect.Solution:
In
DomainResetPage.tsx, callNavigation.goBack(ROUTES.WORKSPACES_LIST.route)beforeresetDomain()so the user navigates away before the optimistic Onyx update nullifies the domain data and triggers the NotFound view on the persistentDomainInitialPage.const handleResetDomain = () => { if (isSubmitDisabled) { ... } + Navigation.goBack(ROUTES.WORKSPACES_LIST.route); resetDomain(route.params.domainAccountID, domainName, domain); - Navigation.goBack(ROUTES.WORKSPACES_LIST.route); };Investigation details
Data flow causing the bug:
DomainResetPage(RHP) at routedomain/:domainAccountID/admins/:accountID/reset-domainhandleResetDomain()firesresetDomain()optimistically merges domain tonullvia Onyx — this is synchronousDomainInitialPage(persistent sidebar, always mounted) re-renders:!domainis nowtrueFullPageNotFoundViewrenders withshouldShow=true→ user sees "Not here" pageNavigation.goBack()from bothDomainResetPageandDomainInitialPage's useEffect fire, but too late — the NotFound view already renderedAlternative explanations considered:
DomainInitialPagealso callsgoBackas a fallback and users do eventually leave the pageConfidence: High — both researchers independently confirmed the same race condition with specific file:line evidence.
Related issues: Several other "Not here" page issues follow similar patterns where optimistic deletion triggers NotFound before navigation completes:
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Apr 30, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ShridharGoel (
External)MobileMage commentedon Apr 30, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
After a user resets a domain, the "Not here" (404) page is briefly shown before — or instead of — landing on the workspaces list page.
What is the root cause of that problem?
The problem is a race condition between two concurrent navigation actions triggered by the domain reset. In
DomainResetPage.handleResetDomain, the code callsresetDomain(...)first and then immediately callsNavigation.goBack(ROUTES.WORKSPACES_LIST.route). TheresetDomainaction applies an optimistic update that sets the domain's Onyx entry tonullsynchronously. This triggers a re-render ofDomainInitialPage, which is still mounted in the navigator stack. ItsuseEffect(line 109–115) evaluatesdomainas falsy andshouldShowFullScreenLoadingIndicatoras false, so it also callsNavigation.goBack(ROUTES.WORKSPACES_LIST.route). Meanwhile, theFullPageNotFoundViewinDomainInitialPagewithshouldShow={!domain || !isAdmin}immediately becomestrueand renders the "Not here" page because the domain was nullified. The result is that the user sees the not-found screen during the brief window between the optimistic update and the navigation completing.App/src/pages/domain/DomainResetPage.tsx
Lines 55 to 62 in 680b88f
What changes do you think we should make in order to solve the problem?
In
DomainResetPage, the navigation should happen before callingresetDomain, not after. Swapping the order so thatNavigation.navigate(ROUTES.WORKSPACES_LIST.route)(usingnavigaterather thangoBack, sincegoBackdepends on stack history) fires first takes the user off the domain screens before the optimistic Onyx update nullifies the domain data. This preventsDomainInitialPagefrom ever rendering the not-found state in response to the reset, since the page is no longer active in the foreground when the data changes.Additionally,
DomainInitialPage's redirectuseEffectshould also check whether the domain has a pending delete action (CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETEonDOMAIN_PENDING_ACTIONS) and skip thegoBackcall in that case, so that even if the screen is still briefly in the navigator stack during a reset it does not redundantly fire a competing navigation. This guards against similar timing issues in other flows that might delete the domain.App/src/pages/domain/DomainInitialPage.tsx
Lines 109 to 115 in 680b88f
What alternative solutions did you explore? (Optional)
N/A
[-]88633R2 - Domain - Not here page appears after resetting the domain[/-][+][$250] 88633R2 - Domain - Not here page appears after resetting the domain[/+]melvin-bot commentedon Apr 30, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022049794401741844689
KJ21-ENG commentedon Apr 30, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
aswin-s commentedon Apr 30, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-04-30 10:20:12 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the only domain admin resets a domain, the app briefly navigates back into the deleted domain flow and shows a
Not herepage instead of returning to the workspaces list.What is the root cause of that problem?
The regression is in
src/pages/domain/DomainResetPage.tsx, in the access guard that was added to prevent opening the reset page when a domain has multiple admins.DomainResetDomainPageuses this effect:That guard uses
domainHasOnlyOneAdmin, which is derived fromadminAccountIDsSelector(domain). Insrc/selectors/Domain.ts,adminAccountIDsSelector()returns[]whendomainisnull.During
resetDomain()insrc/libs/actions/Domain.ts, the optimistic update immediately setsDOMAIN.${domainAccountID}tonull. As soon as that happens:adminAccountIDsSelector(null)returns[]domainHasOnlyOneAdminflips tofalseNavigation.goBack(ROUTES.DOMAIN_ADMIN_DETAILS.getRoute(...))That sends the user back to
DomainAdminDetailsPage, which renders throughBaseDomainMemberDetailsComponentintoDomainNotFoundPageWrapper. Since the domain was just deleted,DomainNotFoundPageWrapperevaluates!domainastrueand shows theNot herepage.So the deepest root cause is not the reset action itself. The problem is that the reset-page guard uses admin-count state as a proxy for access validity and does not distinguish between these two different cases:
Those states must not be handled the same way.
What changes do you think we should make in order to solve the problem?
Update the
useEffectguard insrc/pages/domain/DomainResetPage.tsxso it only redirects toDOMAIN_ADMIN_DETAILSwhen the domain still exists and the page has become invalid because there are now multiple admins.Concretely:
domainisnulldomainto the dependency array because the redirect condition now depends on ithandleResetDomain()as-is; its existingNavigation.goBack(ROUTES.WORKSPACES_LIST.route)is already the correct navigation after a successful resetThe redirect condition should effectively become:
This is also consistent with the existing pattern in
src/pages/domain/DomainInitialPage.tsx, which distinguishes a missing domain from a valid-but-inaccessible domain instead of routing deeper into deleted-domain screens.What alternative solutions did you explore? (Optional)
handleResetDomain()to use a different navigation call was rejected because the submit handler is already correct; the regression is the access guard firing after the optimistic delete.github-actions commentedon Apr 30, 2026
mukhrr commentedon Apr 30, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
43 remaining items
melvin-bot commentedon May 21, 2026
@ShridharGoel The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
melvin-bot commentedon May 26, 2026
@ShridharGoel Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon May 27, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)ShridharGoel commentedon May 27, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: [Release 1] [Domain Control] Reset domain #77969 (comment)
Link to the comment on the Issue:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/642745
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-cf7f-a8e3-3168-dfc3d5fe7964melvin-bot commentedon May 28, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon May 29, 2026
Payment Summary
Contributor: @emkhalid paid $250 via Upwork
Contributor+: @ShridharGoel due $250 via NewDot
@emkhalid can you please accept the job below? Please reply here and tag me once you have.
If you're not sent an offer in Upwork when you're assigned to an issue, and an Upwork job exists, please submit a proposal.
https://www.upwork.com/jobs/~022049794401741844689
^ Test case created. Thx
emkhalid commentedon May 30, 2026
@mallenexpensify I accepted the offer, thanks
mallenexpensify commentedon May 30, 2026
@emkhalid paid, summary updated above. Thx.
garrettmknight commentedon Jun 1, 2026
$250 approved for @ShridharGoel