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-06-24] [$250] Login - Blank page opens when login via magic link different session #89545
When a user opens a magic link in an incognito/different-session browser window and clicks "Just sign in here", credentials.login is never populated because the signInWithValidateCode success handler only sets credentials.accountID and credentials.validateCode — not credentials.login.
After the API call succeeds, the component re-renders with isSignedIn=true, autoAuthState=JUST_SIGNED_IN, but login=undefined. At this point, every render condition in ValidateLoginPage/index.website.tsx evaluates to false:
The component renders an empty <></> fragment — a blank page. Eventually AppNavigator switches to AuthScreens (which is lazy-loaded with Suspense fallback={null}), extending the blank period until the JS chunk loads and ValidateLoginPage remounts and calls Navigation.goBack().
What changes do you think we should make in order to solve the problem?
This ensures JustSignedInModal renders during the transition period regardless of whether credentials.login is populated, eliminating the blank page. The user sees the "You have been signed in" modal until AuthScreens loads and navigation completes.
What alternative solutions did you explore? (Optional)
An alternative would be to populate credentials.login in the signInWithValidateCode success handler (from the API response), but this would require server-side changes and doesn't address the fundamental render gap where no condition matches the incognito sign-in state.
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.
When expenses are grouped by Merchant on the Spend → Expenses search page, clicking the group checkbox triggers a selection handler in SearchListWithHeader that iterates over child transaction items to build the set of IDs to select. In the grouped view, each group header list item is expected to carry a transactions (or equivalent child items) array. However, the grouped list item shape built in SearchUIUtils doesn't always include that field — so when the checkbox handler tries to call .map() on it, it gets undefined, throws a TypeError, and React Native's error boundary crashes the page.
The crash only surfaces in the grouped view because flat (ungrouped) list items go through a different code path that always has transaction IDs attached directly to the item. Group headers, however, are constructed separately and don't always carry the child transactions array, leaving the checkbox handler with nothing safe to iterate over.
What changes do you think we should make in order to solve the problem?
There are two changes needed — a defensive guard at the point of use, and a data-contract fix at the source.
First, in the group checkbox press handler inside SearchListWithHeader, guard against a missing child array so a missing transactions field produces an empty selection rather than a crash:
Second, in the grouped list item builder in SearchUIUtils, ensure every group header item is constructed with a transactions field so the contract is explicit and safe for all callers going forward:
transactions is already used elsewhere in the search list item type — this just makes it a required field on group headers rather than implicitly absent. Together, the two changes eliminate the crash: the first is a safety net at the usage site, the second makes the data shape consistent at the construction site.
What alternative solutions did you explore?
I considered wrapping the group checkbox handler in a try/catch to silently swallow the error, but that would hide the bad data rather than fix it — the group would still silently fail to select anything. I also looked at whether the grouped view could reuse the same flat item shape entirely, but that would require a larger refactor of SearchUIUtils well beyond the scope of a targeted bug fix. The two-line guard above is the minimal, safe change that fixes the crash without touching unrelated code paths.
changed the title [-]Login - Blank page opens when login via magic link different session[/-][+][$250] Login - Blank page opens when login via magic link different session[/+]on May 4, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user opens a magic link in a fresh incognito session (no stored credentials) and clicks "Just sign in here" to authenticate, the app shows a blank page instead of the expected login success modal. The user successfully authenticates—the server confirms the sign-in and sets isSignedIn=true—but the UI fails to render any confirmation or next step, leaving the user stranded on a blank screen.
What is the root cause of that problem?
The bug originates in src/pages/ValidateLoginPage/index.website.tsx at line 88, in the JSX render condition for the non-2FA JustSignedInModal:
In a fresh incognito session, credentials.login is never populated from storage because no prior session exists. When signInWithValidateCode() succeeds via the "Just sign in here" flow, autoAuthState transitions to JUST_SIGNED_IN and isSignedIn becomes true—but login remains undefined. The !!login guard evaluates to false, blocking the modal render. Simultaneously, all four other JSX branches fail their conditions: ExpiredValidateCodeModal needs FAILED state, the 2FA JustSignedInModal (line 85–87) needs is2FARequired=true, ValidateCodeModal needs autoAuthState===NOT_STARTED, and FullScreenLoadingIndicator needs SIGNING_IN state. With all conditions false, the component returns an empty fragment—a blank page.
The guard was intended to distinguish "user just signed in via magic link in this session" from "user was already signed in and is just navigating," but it inadvertently excludes fresh incognito sessions where no login was ever stored. Compare the working analog at src/pages/ValidateLoginPage/index.tsx (the non-website variant):
That version does not apply the !!login guard, correctly rendering the success modal.
What changes do you think we should make in order to solve the problem?
File:src/pages/ValidateLoginPage/index.website.tsx Function:ValidateLoginPage Edit: Remove the !!login guard from line 88. The condition autoAuthStateWithDefault === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && isSignedIn && !exitTo is already sufficient to uniquely identify the post-sign-in success state. The JUST_SIGNED_IN state only becomes active after a sign-in event within the current session, so the distinction between "just signed in" and "already signed in" is already encoded. The !!login check incorrectly blocks the modal when login is undefined—a valid scenario in fresh incognito sessions—so it must be removed.
Blast radius: Isolated to the JSX render condition on line 88. No helper functions, shared state, or other components are modified. The change is a strict simplification of a local conditional.
What alternative solutions did you explore? (Optional)
Replace the condition with isUserClickedSignIn && JUST_SIGNED_IN (candidate from S2 analysis) Rejection reason:isUserClickedSignIn is defined as !login && isSignedIn && (...), which evaluates to false whenever login is stored. This would regress the expired-session re-auth scenario: a user with stored credentials opens a magic link, signs in via magic link, and should see the success modal, but isUserClickedSignIn would remain false because !login is false. The modal would not render.
Add Navigation.goBack() in a useEffect for the JUST_SIGNED_IN + !login path Rejection reason: This would send the user backward through navigation after a successful sign-in, defeating the purpose of the sign-in flow. The expected outcome per the issue is successful login confirmation, not navigation back.
When the magic link is opened in a fresh browser session (incognito), credentials.login is never populated — that field is only set when the user types their email into the SignIn form, which doesn't happen on a magic-link-only flow. After "Just sign in here" succeeds, the API returns 200 and Onyx merges authToken, accountID, email, encryptedAuthToken onto session, but the successData only writes accountID and validateCode to CREDENTIALS — not login:
So at the moment autoAuthState becomes JUST_SIGNED_IN, the state is isSignedIn=true, login=undefined, exitTo=undefined. None of the render branches in ValidateLoginPage/index.website.tsx match, since both JustSignedInModal branches require !!login:
{/* If session.autoAuthState isn't available yet, we use shouldStartSignInWithValidateCode to conditionally render the component instead of local autoAuthState which contains a default value of NOT_STARTED */}
The fallback Navigation.goBack() in the existing effect doesn't help because incognito has no history (the console confirms [hmmm] [Navigation] Unable to go back). The screen renders nothing → blank page. The same blank page also shows when the user revisits a /v/... URL inside an incognito session that has Onyx-restored credentials from an earlier sign-in (Onyx persists to IndexedDB, which is shared across same-origin tabs in the same incognito profile).
What changes do you think we should make in order to solve the problem?
I'd extend the existing post-mount effect in ValidateLoginPage/index.website.tsx so that, when the user is signed in but has no login (i.e. no original tab to head back to), we route them to the app home instead of leaving a blank page. The existing 2FA same-tab goBack() branch is preserved for the signed-out case it already handled. The render gates that depend on !!login stay as-is, so the multi-tab "Abracadabra, head back to your original tab" UX is unchanged when a login is present.
useEffect(() => {
- if (!!login || !cachedAccountID || !is2FARequired) {- if (exitTo) {- handleExitToNavigation(exitTo);- }+ if (exitTo) {+ handleExitToNavigation(exitTo);+ return;+ }+ if (login) {
return;
}
-- // The user clicked the option to sign in the current tab
Navigation.isNavigationReady().then(() => {
- Navigation.goBack();+ // No `login` means there's no original tab to head back to (e.g. magic link opened+ // in incognito). Once signed in, route to the app home instead of leaving a blank+ // page; otherwise the existing same-tab 2FA flow falls back to goBack().+ if (isSignedIn) {+ Navigation.navigate(ROUTES.HOME);+ return;+ }+ if (cachedAccountID && is2FARequired) {+ Navigation.goBack();+ }
});
-}, [login, cachedAccountID, is2FARequired, exitTo]);+}, [login, cachedAccountID, is2FARequired, exitTo, isSignedIn]);
This covers both observed shapes of the bug:
Fresh incognito → user sees ValidateCodeModal, clicks "Just sign in here", sign-in completes (isSignedIn=true, login=undefined) → effect re-runs on the dep change and lands them on Home.
Same incognito profile with Onyx-restored credentials → isSignedIn is already true at mount, the same effect lands them on Home rather than rendering blank.
A small import addition is also needed: import ROUTES from '@src/ROUTES';.
What alternative solutions did you explore? (Optional)
Drop !!login from the JustSignedInModal render gates. This unblocks the blank page but shows "Abracadabra, head back to your original tab" — misleading because in incognito there is no original tab. Verified manually: the user is "signed in" but stuck on a dead-end screen, which doesn't satisfy the bug's Expected Result of "User should log in".
Use Navigation.resetToHome() instead of Navigation.navigate(ROUTES.HOME). Verified manually too: resetToHome dispatches into ReportsSplitNavigator, which doesn't yet exist in the navigator state during the PublicScreens → AuthScreens transition, so it logs [handleReplaceReportsSplitNavigatorAction] ReportsSplitNavigator has not been found in the navigation state. and the page stays blank. Navigation.navigate(ROUTES.HOME) is path-based and works regardless of the navigator transition timing.
Populate credentials.login in signInWithValidateCode's successData. This would make the existing !!login render guards work, but the email isn't available client-side at the time the optimistic/success Onyx data is built — we'd have to thread it through the response, which is more invasive than gating navigation on isSignedIn alone.
On web, when a magic link https://staging.new.expensify.com/v/{accountID}/{validateCode} is opened in an incognito window, the route resolves to ValidateLoginPage (website variant). In a fresh incognito session none of session?.authToken, credentials?.login, or the route param exitTo exist, so on src/pages/ValidateLoginPage/index.website.tsx:39 the boolean shouldStartSignInWithValidateCode evaluates to false because of the (!!login || !!exitTo) clause that was tightened in e809d0bdd3b (it requires either a stored login or an exitTo to auto‑initiate sign‑in).
That should mean the render guard on src/pages/ValidateLoginPage/index.website.tsx:90 renders ValidateCodeModal. However, the recent refactor in 8e2368d396c ("Revert 'Revert [Onyx Audit] Migrate keys to RAM-only part 2/2'") replaced the old useOnyx(ONYXKEYS.SESSION, {initWithStoredValues: isSignedIn, ...}) guard with a useState(isSignedIn) + setHasInitialized(true) masking pattern at src/pages/ValidateLoginPage/index.website.tsx:32-34. The new pattern produces three sequential renders for an unauthenticated user:
Mount: hasInitialized=false, so effectiveAutoAuthState=undefined. Guard takes the !effectiveAutoAuthState branch → renders ValidateCodeModal.
After useEffect fires setHasInitialized(true): hasInitialized=true but autoAuthState is still undefined (Onyx merge from initAutoAuthState is async). Guard re-evaluates the same branch → re-renders ValidateCodeModal.
After Onyx commits autoAuthState=NOT_STARTED: guard flips to the autoAuthStateWithDefault === NOT_STARTED && !isNavigatingToExitTo branch — same boolean result, but it's a different expression so React unmounts and remounts ValidateCodeModal.
The unmount/remount discards the useMemoizedLazyIllustrations(['MagicCode']) async chunk load started in step 1 (isMounted flag in src/hooks/useLazyAsset.ts:127-140 prevents setAssets from running on the unmounted instance), and the new mount in step 3 starts another async load. Until that resolves the modal renders with assets={}, so the <Icon src={illustrations.MagicCode} /> and the entire <View style={styles.deeplinkWrapperContainer}> paint with no measurable content because Icon returns nothing for an undefined source — leaving only the full‑screen theme.appBG background and producing the blank page the tester sees. The "Just sign In here" text link inside the same <View> does not paint until the chunk eventually loads, and on a slow first connection in incognito (cold cache) the chunk request can stall behind other prefetches, leaving the page visibly blank.
What changes do you think we should make in order to solve the problem?
Eliminate the unmount/remount of ValidateCodeModal by keeping the render guard on a single boolean expression across all three renders. In src/pages/ValidateLoginPage/index.website.tsx:32-34 drop the useState/hasInitialized/effectiveAutoAuthState indirection and compute a single derived value, e.g. set effectiveAutoAuthState = isSignedIn ? autoAuthState : autoAuthState ?? CONST.AUTO_AUTH_STATE.NOT_STARTED (or simply normalize to NOT_STARTED for unauthenticated users). Then change line 90 to a stable predicate: render ValidateCodeModal whenever autoAuthStateWithDefault === NOT_STARTED && !isNavigatingToExitTo. With a stable predicate the modal is mounted exactly once across the three renders, and the lazy illustration chunk that was kicked off on first mount can complete and call setAssets on the still‑mounted instance.
Also remove the now‑unused setHasInitialized(true) line at src/pages/ValidateLoginPage/index.website.tsx:44 and the corresponding useState import. The "stale FAILED autoAuthState" concern that motivated the original refactor is already handled because initAutoAuthState is invoked synchronously on mount and overwrites stale values to NOT_STARTED/JUST_SIGNED_IN before the user can interact.
A defensive secondary fix in src/components/ValidateCode/ValidateCodeModal.tsx:54-58: when illustrations.MagicCode is undefined the wrapping <View> should still render the headline, code digits, and "Just sign In here" link. Currently the children render but the modal's only visible "anchor" (the icon) is missing during the chunk load, which is what makes the unmount/remount visually catastrophic. Pass a PlaceholderIcon fallback so the layout is never empty.
What alternative solutions did you explore? (Optional)
There are no other proposals on this issue yet. An alternative would be to keep the useState/hasInitialized masking but stabilize the boolean — that works but leaves the misleading three‑phase render. Another alternative would be to revert just the guard expression on lines 90 and 96 back to the pre‑8e2368d396c shape (!autoAuthState ? ... : ...) without restoring the initWithStoredValues: isSignedIn Onyx option; this also avoids the remount but keeps autoAuthState=undefined as a possible "valid" runtime state, which the rest of the file does not really expect. The cleaner change is to normalize autoAuthState to NOT_STARTED for unauthenticated users and use a single predicate, as described above. The earlier "Skip prepending TabNavigator for public screens" fix in 15020f6ab2b is unrelated — it only affects the navigator RESET action, not what ValidateLoginPage paints.
⚠️@oqildev Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
@MelvinBot payment is due on this issue. Review the above regressions/deploy blockers related to the PR for this issue to determine how much is due. Return a bulleted list of offending PRs and mention if their associated/linked GH issue was paid. Payment details are in https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md. include proposed payment details in the below format
Payment Summary
Contributor: @user paid $250 via Upwork
Contributor+: @user due $250 via NewDot
@mkhutornyi once Melv is finished above, please comment on the DBs mentioned. From the C+ doc
If there are posts on the PR or issue that reference a regression or deploy blocker, C+ posts on the issue and confirms regression (which will reduce pay by 50%) or provides reasoning why they shouldn’t be considered. If the C+ doesn’t update the issue, the contributor manager making the payment will assume any mention of a regression or deploy blockers reduces the issue amount.
TL;DR: No regression penalty applies. Both deploy blockers raised against the offending PR were demoted/invalidated (one as intended behavior, one as a pre-existing, non-regression edge case), so the 50% per-regression penalty does not apply. Full payment is due to both assignees.
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: The bug existed for long time
[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:
[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.
Activity
MelvinBot commentedon May 4, 2026
Proposal
What is the root cause of that problem?
When a user opens a magic link in an incognito/different-session browser window and clicks "Just sign in here",
credentials.loginis never populated because thesignInWithValidateCodesuccess handler only setscredentials.accountIDandcredentials.validateCode— notcredentials.login.After the API call succeeds, the component re-renders with
isSignedIn=true,autoAuthState=JUST_SIGNED_IN, butlogin=undefined. At this point, every render condition inValidateLoginPage/index.website.tsxevaluates to false:FAILEDstate — false!isSignedIn && !!login— false!!login— false (this is the key gap)NOT_STARTED— falseSIGNING_IN— falseThe component renders an empty
<></>fragment — a blank page. EventuallyAppNavigatorswitches toAuthScreens(which is lazy-loaded withSuspense fallback={null}), extending the blank period until the JS chunk loads andValidateLoginPageremounts and callsNavigation.goBack().What changes do you think we should make in order to solve the problem?
Remove the
!!loginguard from theJustSignedInModalrender condition on line 88 ofValidateLoginPage/index.website.tsx:Before:
autoAuthStateWithDefault === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && isSignedIn && !exitTo && !!loginAfter:
autoAuthStateWithDefault === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && isSignedIn && !exitToThis ensures
JustSignedInModalrenders during the transition period regardless of whethercredentials.loginis populated, eliminating the blank page. The user sees the "You have been signed in" modal untilAuthScreensloads and navigation completes.What alternative solutions did you explore? (Optional)
An alternative would be to populate
credentials.loginin thesignInWithValidateCodesuccess handler (from the API response), but this would require server-side changes and doesn't address the fundamental render gap where no condition matches the incognito sign-in state.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.David-2002065 commentedon May 4, 2026
Proposal
What is the root cause of that problem?
When expenses are grouped by Merchant on the Spend → Expenses search page, clicking the group checkbox triggers a selection handler in
SearchListWithHeaderthat iterates over child transaction items to build the set of IDs to select. In the grouped view, each group header list item is expected to carry atransactions(or equivalent child items) array. However, the grouped list item shape built inSearchUIUtilsdoesn't always include that field — so when the checkbox handler tries to call.map()on it, it getsundefined, throws aTypeError, and React Native's error boundary crashes the page.The selection handler lives here:
👉 https://github.com/Expensify/App/blob/main/src/components/Search/SearchListWithHeader.tsx
The grouped item builder that produces the incomplete item shape lives here:
👉 https://github.com/Expensify/App/blob/main/src/utils/SearchUIUtils.ts
The crash only surfaces in the grouped view because flat (ungrouped) list items go through a different code path that always has transaction IDs attached directly to the item. Group headers, however, are constructed separately and don't always carry the child
transactionsarray, leaving the checkbox handler with nothing safe to iterate over.What changes do you think we should make in order to solve the problem?
There are two changes needed — a defensive guard at the point of use, and a data-contract fix at the source.
First, in the group checkbox press handler inside
SearchListWithHeader, guard against a missing child array so a missingtransactionsfield produces an empty selection rather than a crash:Second, in the grouped list item builder in
SearchUIUtils, ensure every group header item is constructed with atransactionsfield so the contract is explicit and safe for all callers going forward:transactionsis already used elsewhere in the search list item type — this just makes it a required field on group headers rather than implicitly absent. Together, the two changes eliminate the crash: the first is a safety net at the usage site, the second makes the data shape consistent at the construction site.What alternative solutions did you explore?
I considered wrapping the group checkbox handler in a
try/catchto silently swallow the error, but that would hide the bad data rather than fix it — the group would still silently fail to select anything. I also looked at whether the grouped view could reuse the same flat item shape entirely, but that would require a larger refactor ofSearchUIUtilswell beyond the scope of a targeted bug fix. The two-line guard above is the minimal, safe change that fixes the crash without touching unrelated code paths.melvin-bot commentedon May 4, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)melvin-bot commentedon May 4, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022051363824384416616
[-]Login - Blank page opens when login via magic link different session[/-][+][$250] Login - Blank page opens when login via magic link different session[/+]aswin-s commentedon May 4, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user opens a magic link in a fresh incognito session (no stored credentials) and clicks "Just sign in here" to authenticate, the app shows a blank page instead of the expected login success modal. The user successfully authenticates—the server confirms the sign-in and sets
isSignedIn=true—but the UI fails to render any confirmation or next step, leaving the user stranded on a blank screen.What is the root cause of that problem?
The bug originates in
src/pages/ValidateLoginPage/index.website.tsxat line 88, in the JSX render condition for the non-2FAJustSignedInModal:App/src/pages/ValidateLoginPage/index.website.tsx
Line 88 in cab81ee
The condition requires
!!loginto be true:In a fresh incognito session,
credentials.loginis never populated from storage because no prior session exists. WhensignInWithValidateCode()succeeds via the "Just sign in here" flow,autoAuthStatetransitions toJUST_SIGNED_INandisSignedInbecomes true—butloginremainsundefined. The!!loginguard evaluates to false, blocking the modal render. Simultaneously, all four other JSX branches fail their conditions:ExpiredValidateCodeModalneedsFAILEDstate, the 2FAJustSignedInModal(line 85–87) needsis2FARequired=true,ValidateCodeModalneedsautoAuthState===NOT_STARTED, andFullScreenLoadingIndicatorneedsSIGNING_INstate. With all conditions false, the component returns an empty fragment—a blank page.The guard was intended to distinguish "user just signed in via magic link in this session" from "user was already signed in and is just navigating," but it inadvertently excludes fresh incognito sessions where no login was ever stored. Compare the working analog at
src/pages/ValidateLoginPage/index.tsx(the non-website variant):App/src/pages/ValidateLoginPage/index.tsx
Line 1 in cab81ee
That version does not apply the
!!loginguard, correctly rendering the success modal.What changes do you think we should make in order to solve the problem?
File:
src/pages/ValidateLoginPage/index.website.tsxFunction:
ValidateLoginPageEdit: Remove the
!!loginguard from line 88. The conditionautoAuthStateWithDefault === CONST.AUTO_AUTH_STATE.JUST_SIGNED_IN && isSignedIn && !exitTois already sufficient to uniquely identify the post-sign-in success state. TheJUST_SIGNED_INstate only becomes active after a sign-in event within the current session, so the distinction between "just signed in" and "already signed in" is already encoded. The!!logincheck incorrectly blocks the modal whenloginis undefined—a valid scenario in fresh incognito sessions—so it must be removed.New condition:
Blast radius: Isolated to the JSX render condition on line 88. No helper functions, shared state, or other components are modified. The change is a strict simplification of a local conditional.
What alternative solutions did you explore? (Optional)
Replace the condition with
isUserClickedSignIn && JUST_SIGNED_IN(candidate from S2 analysis)Rejection reason:
isUserClickedSignInis defined as!login && isSignedIn && (...), which evaluates to false wheneverloginis stored. This would regress the expired-session re-auth scenario: a user with stored credentials opens a magic link, signs in via magic link, and should see the success modal, butisUserClickedSignInwould remain false because!loginis false. The modal would not render.Add
Navigation.goBack()in a useEffect for theJUST_SIGNED_IN + !loginpathRejection reason: This would send the user backward through navigation after a successful sign-in, defeating the purpose of the sign-in flow. The expected outcome per the issue is successful login confirmation, not navigation back.
mukhrr commentedon May 4, 2026
Proposal
What is the root cause of that problem?
When the magic link is opened in a fresh browser session (incognito),
credentials.loginis never populated — that field is only set when the user types their email into the SignIn form, which doesn't happen on a magic-link-only flow. After "Just sign in here" succeeds, the API returns 200 and Onyx mergesauthToken, accountID, email, encryptedAuthTokenontosession, but thesuccessDataonly writesaccountIDandvalidateCodetoCREDENTIALS— notlogin:App/src/libs/actions/Session/index.ts
Lines 922 to 930 in 053ec53
So at the moment
autoAuthStatebecomesJUST_SIGNED_IN, the state isisSignedIn=true,login=undefined,exitTo=undefined. None of the render branches inValidateLoginPage/index.website.tsxmatch, since bothJustSignedInModalbranches require!!login:App/src/pages/ValidateLoginPage/index.website.tsx
Lines 84 to 106 in 053ec53
The fallback
Navigation.goBack()in the existing effect doesn't help because incognito has no history (the console confirms[hmmm] [Navigation] Unable to go back). The screen renders nothing → blank page. The same blank page also shows when the user revisits a/v/...URL inside an incognito session that has Onyx-restored credentials from an earlier sign-in (Onyx persists to IndexedDB, which is shared across same-origin tabs in the same incognito profile).What changes do you think we should make in order to solve the problem?
I'd extend the existing post-mount effect in
ValidateLoginPage/index.website.tsxso that, when the user is signed in but has nologin(i.e. no original tab to head back to), we route them to the app home instead of leaving a blank page. The existing 2FA same-tabgoBack()branch is preserved for the signed-out case it already handled. The render gates that depend on!!loginstay as-is, so the multi-tab "Abracadabra, head back to your original tab" UX is unchanged when aloginis present.useEffect(() => { - if (!!login || !cachedAccountID || !is2FARequired) { - if (exitTo) { - handleExitToNavigation(exitTo); - } + if (exitTo) { + handleExitToNavigation(exitTo); + return; + } + if (login) { return; } - - // The user clicked the option to sign in the current tab Navigation.isNavigationReady().then(() => { - Navigation.goBack(); + // No `login` means there's no original tab to head back to (e.g. magic link opened + // in incognito). Once signed in, route to the app home instead of leaving a blank + // page; otherwise the existing same-tab 2FA flow falls back to goBack(). + if (isSignedIn) { + Navigation.navigate(ROUTES.HOME); + return; + } + if (cachedAccountID && is2FARequired) { + Navigation.goBack(); + } }); -}, [login, cachedAccountID, is2FARequired, exitTo]); +}, [login, cachedAccountID, is2FARequired, exitTo, isSignedIn]);This covers both observed shapes of the bug:
ValidateCodeModal, clicks "Just sign in here", sign-in completes (isSignedIn=true,login=undefined) → effect re-runs on the dep change and lands them on Home.isSignedInis already true at mount, the same effect lands them on Home rather than rendering blank.A small import addition is also needed:
import ROUTES from '@src/ROUTES';.What alternative solutions did you explore? (Optional)
!!loginfrom theJustSignedInModalrender gates. This unblocks the blank page but shows "Abracadabra, head back to your original tab" — misleading because in incognito there is no original tab. Verified manually: the user is "signed in" but stuck on a dead-end screen, which doesn't satisfy the bug's Expected Result of "User should log in".Navigation.resetToHome()instead ofNavigation.navigate(ROUTES.HOME). Verified manually too:resetToHomedispatches intoReportsSplitNavigator, which doesn't yet exist in the navigator state during the PublicScreens → AuthScreens transition, so it logs[handleReplaceReportsSplitNavigatorAction] ReportsSplitNavigator has not been found in the navigation state.and the page stays blank.Navigation.navigate(ROUTES.HOME)is path-based and works regardless of the navigator transition timing.credentials.logininsignInWithValidateCode'ssuccessData. This would make the existing!!loginrender guards work, but the email isn't available client-side at the time the optimistic/success Onyx data is built — we'd have to thread it through the response, which is more invasive than gating navigation onisSignedInalone.Result:
REC-20260508101731.mp4
oqildev commentedon May 4, 2026
Proposal
What is the root cause of that problem?
On web, when a magic link
https://staging.new.expensify.com/v/{accountID}/{validateCode}is opened in an incognito window, the route resolves toValidateLoginPage(website variant). In a fresh incognito session none ofsession?.authToken,credentials?.login, or the route paramexitToexist, so on src/pages/ValidateLoginPage/index.website.tsx:39 the booleanshouldStartSignInWithValidateCodeevaluates tofalsebecause of the(!!login || !!exitTo)clause that was tightened ine809d0bdd3b(it requires either a stored login or anexitToto auto‑initiate sign‑in).That should mean the render guard on src/pages/ValidateLoginPage/index.website.tsx:90 renders
ValidateCodeModal. However, the recent refactor in8e2368d396c("Revert 'Revert [Onyx Audit] Migrate keys to RAM-only part 2/2'") replaced the olduseOnyx(ONYXKEYS.SESSION, {initWithStoredValues: isSignedIn, ...})guard with auseState(isSignedIn)+setHasInitialized(true)masking pattern at src/pages/ValidateLoginPage/index.website.tsx:32-34. The new pattern produces three sequential renders for an unauthenticated user:hasInitialized=false, soeffectiveAutoAuthState=undefined. Guard takes the!effectiveAutoAuthStatebranch → rendersValidateCodeModal.setHasInitialized(true):hasInitialized=truebutautoAuthStateis stillundefined(Onyx merge frominitAutoAuthStateis async). Guard re-evaluates the same branch → re-rendersValidateCodeModal.autoAuthState=NOT_STARTED: guard flips to theautoAuthStateWithDefault === NOT_STARTED && !isNavigatingToExitTobranch — same boolean result, but it's a different expression so React unmounts and remountsValidateCodeModal.The unmount/remount discards the
useMemoizedLazyIllustrations(['MagicCode'])async chunk load started in step 1 (isMountedflag in src/hooks/useLazyAsset.ts:127-140 preventssetAssetsfrom running on the unmounted instance), and the new mount in step 3 starts another async load. Until that resolves the modal renders withassets={}, so the<Icon src={illustrations.MagicCode} />and the entire<View style={styles.deeplinkWrapperContainer}>paint with no measurable content becauseIconreturns nothing for anundefinedsource — leaving only the full‑screentheme.appBGbackground and producing the blank page the tester sees. The "Just sign In here" text link inside the same<View>does not paint until the chunk eventually loads, and on a slow first connection in incognito (cold cache) the chunk request can stall behind other prefetches, leaving the page visibly blank.What changes do you think we should make in order to solve the problem?
Eliminate the unmount/remount of
ValidateCodeModalby keeping the render guard on a single boolean expression across all three renders. In src/pages/ValidateLoginPage/index.website.tsx:32-34 drop theuseState/hasInitialized/effectiveAutoAuthStateindirection and compute a single derived value, e.g. seteffectiveAutoAuthState = isSignedIn ? autoAuthState : autoAuthState ?? CONST.AUTO_AUTH_STATE.NOT_STARTED(or simply normalize toNOT_STARTEDfor unauthenticated users). Then change line 90 to a stable predicate: renderValidateCodeModalwheneverautoAuthStateWithDefault === NOT_STARTED && !isNavigatingToExitTo. With a stable predicate the modal is mounted exactly once across the three renders, and the lazy illustration chunk that was kicked off on first mount can complete and callsetAssetson the still‑mounted instance.Also remove the now‑unused
setHasInitialized(true)line at src/pages/ValidateLoginPage/index.website.tsx:44 and the correspondinguseStateimport. The "stale FAILED autoAuthState" concern that motivated the original refactor is already handled becauseinitAutoAuthStateis invoked synchronously on mount and overwrites stale values toNOT_STARTED/JUST_SIGNED_INbefore the user can interact.A defensive secondary fix in src/components/ValidateCode/ValidateCodeModal.tsx:54-58: when
illustrations.MagicCodeisundefinedthe wrapping<View>should still render the headline, code digits, and "Just sign In here" link. Currently the children render but the modal's only visible "anchor" (the icon) is missing during the chunk load, which is what makes the unmount/remount visually catastrophic. Pass aPlaceholderIconfallback so the layout is never empty.What alternative solutions did you explore? (Optional)
There are no other proposals on this issue yet. An alternative would be to keep the
useState/hasInitializedmasking but stabilize the boolean — that works but leaves the misleading three‑phase render. Another alternative would be to revert just the guard expression on lines 90 and 96 back to the pre‑8e2368d396cshape (!autoAuthState ? ... : ...) without restoring theinitWithStoredValues: isSignedInOnyx option; this also avoids the remount but keepsautoAuthState=undefinedas a possible "valid" runtime state, which the rest of the file does not really expect. The cleaner change is to normalizeautoAuthStatetoNOT_STARTEDfor unauthenticated users and use a single predicate, as described above. The earlier "Skip prepending TabNavigator for public screens" fix in15020f6ab2bis unrelated — it only affects the navigator RESET action, not whatValidateLoginPagepaints.github-actions commentedon May 4, 2026
54 remaining items
melvin-bot commentedon Jun 23, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jun 23, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jun 26, 2026
@MelvinBot payment is due on this issue. Review the above regressions/deploy blockers related to the PR for this issue to determine how much is due. Return a bulleted list of offending PRs and mention if their associated/linked GH issue was paid. Payment details are in https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md. include proposed payment details in the below format
mallenexpensify commentedon Jun 26, 2026
@mkhutornyi once Melv is finished above, please comment on the DBs mentioned. From the C+ doc
MelvinBot commentedon Jun 26, 2026
🤖 Regression / payment review
TL;DR: No regression penalty applies. Both deploy blockers raised against the offending PR were demoted/invalidated (one as intended behavior, one as a pre-existing, non-regression edge case), so the 50% per-regression penalty does not apply. Full payment is due to both assignees.
Offending PR
mukhrr, merged 2026-06-15), the PR that fixed this issue. Its linked/associated issue is this one ([Due for payment 2026-06-24] [$250] Login - Blank page opens when login via magic link different session #89545), which has not yet been paid — so any valid regression here would have been discountable. Two deploy blockers were auto-assigned to it during the regression period, but both were dismissed:Net result: 0 valid regressions attributable to #90488 → no 50% discount.
Roles
mukhrr— wrote the selected proposal and authored the fix PR auto-sign in with sign in link in separate browser #90488.mkhutornyi— took over the C+ review on 2026-05-28.Both require payment via NewDot Manual Requests (per the melvin-bot summary above).
mkhutornyi commentedon Jun 26, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: The bug existed for long time
[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:
[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/652864
Regression Test Proposal
Test:
Case 1:
Case 2:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-a7a8-a93a-5c92-a3307e127184mkhutornyi commentedon Jun 26, 2026
Main PR: #90488
Follow-up PR: #93656 (we fixed separate bug happening on production)
So as per doc, I'd suggest $375 total.
cc: @mallenexpensify
mallenexpensify commentedon Jun 26, 2026
Payment Summary
Contributor: @mukhrr due $375 via NewDot
Contributor+: @mkhutornyi due $375 via NewDot
^ Test case created. Thx
flaviadefaria commentedon Jun 30, 2026
Approved: @mukhrr paid $375 via Upwork
trjExpensify commentedon Jul 9, 2026
approved $375 for @mkhutornyi