Skip to content

[Due for payment 2026-05-13] [$250] HybridApp - Switch to Expensify Classic silently does nothing on mobile when NVP_TRY_NEW_DOT is populated before the SESSION callback fires #88243

Closed

Description

@Julesssss

Version Number: v9.3.60-17
Reproducible in staging?: Yes
Reproducible in production?: Likely (introduced in #87101, deployed 2026-04-08)
Email or phone of affected tester (no customers):
Issue reported by: @Julesssss (noticed while verifying #88182 fix)

Action Performed

  1. Open the NewDot app on HybridApp (iOS or Android Native)
  2. Do not start a GPS trip
  3. Navigate to Account -> Troubleshoot
  4. Tap "Switch to Expensify Classic"

Expected Result

App hands off to Expensify Classic. NVP_TRY_NEW_DOT.classicRedirect.dismissed flips to true server-side.

Actual Result

Nothing happens. User stays in NewDot. NVP_TRY_NEW_DOT is unchanged server-side:

{
  "classicRedirect": { "dismissed": false, "timestamp": "2026-04-07T15:20:32.352Z" },
  "distance": { "enabled": "true" },
  "smartScan": { "enabled": "true" },
  "tappedTryNewExpensifyButton": { "timestamp": "2026-04-07T15:20:32.352Z" }
}

Web is unaffected (web does not call closeReactNativeApp for this flow).

Root Cause

In src/libs/actions/HybridApp/index.ts:54-67, the SESSION callback unconditionally resets module-level currentTryNewDot = undefined and isLoadingTryNewDot = true on the first transition from undefined to the user's accountID:

Onyx.connectWithoutView({
    key: ONYXKEYS.SESSION,
    callback: (session) => {
        const nextSessionAccountID = getSessionAccountID(session);
        if (nextSessionAccountID === currentSessionAccountID) return;
        currentSessionAccountID = nextSessionAccountID;
        currentTryNewDot = undefined;
        hasReceivedTryNewDotUpdate = false;
        isLoadingTryNewDot = nextSessionAccountID !== undefined || isLoadingApp !== false;
    },
});

If the NVP_TRY_NEW_DOT callback fires before the SESSION callback on app start (common on mobile), currentTryNewDot is set, then immediately blanked. Because the Onyx NVP value itself does not change, the NVP callback never re-fires to repopulate it. The module is permanently stuck with isLoadingTryNewDot = true.

Any subsequent call to closeReactNativeApp({shouldSetNVP: true}) hits the loading-state branch of shouldBlockOldAppExit at index.ts:87 and silently returns. The Troubleshoot button is still rendered because the component-level useOnyx sees the NVP value fine — this is the desync.

Introduced by #87101 (merged 2026-04-08).

Proposed Fix

Skip the module-level reset on the initial undefined -> accountID transition. Only blank currentTryNewDot when the user actually changes (logout/login or cross-user switch):

if (nextSessionAccountID === currentSessionAccountID) return;
const isInitialSessionLoad = currentSessionAccountID === undefined;
currentSessionAccountID = nextSessionAccountID;
if (isInitialSessionLoad) return;
currentTryNewDot = undefined;
hasReceivedTryNewDotUpdate = false;
isLoadingTryNewDot = nextSessionAccountID !== undefined || isLoadingApp !== false;

Existing tests that codify the re-block-on-session-switch behavior (tests/unit/HybridAppActionsTest.ts:118-156) continue to pass because they test a real accountID change, not the initial load.

Workaround

None. Users on mobile who land in this state cannot switch to Classic until they fully sign out and sign back in (which may also fail on first session). Web is unaffected.

Platforms

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Related

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022045263129318285513
  • Upwork Job ID: 2045263129318285513
  • Last Price Increase: 2026-04-17
Issue OwnerCurrent Issue Owner: @abzokhattab

Activity

  1. added
    Daily
    Bug
    on Apr 17, 2026
  2. MelvinBot commented on Apr 17, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The SESSION Onyx callback in src/libs/actions/HybridApp/index.ts:54-67 unconditionally resets currentTryNewDot = undefined and isLoadingTryNewDot = true whenever currentSessionAccountID changes — including the initial undefined → accountID transition on app start.

    On mobile, when NVP_TRY_NEW_DOT fires before SESSION (a normal Onyx delivery ordering), the sequence is:

    1. NVP_TRY_NEW_DOT callback (line 38-44) sets currentTryNewDot and flips isLoadingTryNewDot = false
    2. SESSION callback (line 56-66) sees currentSessionAccountID change from undefined to <number>, so it blanks currentTryNewDot = undefined and sets isLoadingTryNewDot = true
    3. Since Onyx already delivered the NVP value, the NVP callback never re-fires — the module is permanently stuck in a loading state
    4. closeReactNativeApp calls shouldBlockOldAppExit (TryNewDotUtils.ts:9-15) which returns true because isLoadingTryNewDot is stuck at true, so the exit is silently dropped

    What changes do you think we should make in order to solve the problem?

    In the SESSION callback, distinguish between the initial session load (undefined → accountID) and an actual account switch (accountID1 → accountID2). Only reset currentTryNewDot / isLoadingTryNewDot on a real account switch:

    In src/libs/actions/HybridApp/index.ts, inside the SESSION callback, save the previous value before overwriting, early-return on initial load, and only reset state when the previous accountID was a real (non-undefined) value.

    The existing test at tests/unit/HybridAppActionsTest.ts:118-156 ("re-blocks after session switch") continues to pass because it tests accountID 1 → 2, where previousSessionAccountID is non-undefined.

    A new test should be added that sets NVP_TRY_NEW_DOT before SESSION and verifies closeReactNativeApp({shouldSetNVP: true}) still works.

    Related issues
    • Expensify/App#88182 — Deploy blocker for the GPS-specific manifestation of this silent return
    • Expensify/App#80593 — App crashing after start GPS and switch to OD (possibly same underlying race)

    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.

  3. added
    External
    on Apr 17, 2026
  4. added
    Help Wanted
    on Apr 17, 2026
  5. melvin-bot commented on Apr 17, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @abzokhattab (External)

  6. changed the title [-]HybridApp - Switch to Expensify Classic silently does nothing on mobile when NVP_TRY_NEW_DOT is populated before the SESSION callback fires[/-] [+][$250] HybridApp - Switch to Expensify Classic silently does nothing on mobile when NVP_TRY_NEW_DOT is populated before the SESSION callback fires[/+] on Apr 17, 2026
  7. melvin-bot commented on Apr 17, 2026

    @melvin-bot
  8. yuvrajangadsingh commented on Apr 17, 2026

    @yuvrajangadsingh
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    on hybridapp mobile, tapping "switch to expensify classic" silently does nothing when the NVP_TRY_NEW_DOT onyx callback fires before the SESSION callback on app start. the nvp is never flipped server-side and the user stays in newdot.

    What is the root cause of that problem?

    the session callback at src/libs/actions/HybridApp/index.ts:54-67 runs its reset block on every currentSessionAccountID change, including the first undefined -> accountID transition on app start. if the nvp callback at src/libs/actions/HybridApp/index.ts:36-44 arrives first (common on native mobile because each onyx key has its own delivery queue), it sets currentTryNewDot and flips isLoadingTryNewDot to false through updateTryNewDotLoadingState. session then fires, the callback treats the initial undefined -> <accountID> as a session change, and clobbers all three module-level fields:

    currentTryNewDot = undefined;
    hasReceivedTryNewDotUpdate = false;
    isLoadingTryNewDot = nextSessionAccountID !== undefined || isLoadingApp !== false; // true

    onyx does not re-fire the nvp callback because the nvp value itself never changed, so the module is stuck loading forever. any later closeReactNativeApp({shouldSetNVP: true}) hits the shouldSetNVP && isLoadingTryNewDot branch of shouldBlockOldAppExit in src/libs/TryNewDotUtils.ts:14 and returns silently. the troubleshoot button itself still renders because useOnyx in the component reads the nvp directly, so only this action module is desynced.

    What changes do you think we should make in order to solve the problem?

    the session callback needs to skip the reset on the initial undefined -> accountID transition. real account switches (n -> m) and sign-out (n -> undefined) still take the reset path. the edit is scoped to src/libs/actions/HybridApp/index.ts:54-67:

    Onyx.connectWithoutView({
        key: ONYXKEYS.SESSION,
        callback: (session) => {
            const nextSessionAccountID = getSessionAccountID(session);
            if (nextSessionAccountID === currentSessionAccountID) {
                return;
            }
            const isInitialSessionLoad = currentSessionAccountID === undefined;
            currentSessionAccountID = nextSessionAccountID;
            if (isInitialSessionLoad) {
                return;
            }
            currentTryNewDot = undefined;
            hasReceivedTryNewDotUpdate = false;
            isLoadingTryNewDot = nextSessionAccountID !== undefined || isLoadingApp !== false;
        },
    });

    the existing re-blocks shouldSetNVP exits after a session switch... test at tests/unit/HybridAppActionsTest.ts:118-156 keeps passing because it sets accountID 1 (initial, skip reset) and only then switches to accountID 2 (non-initial, reset fires, closeNativeAppSpy is correctly blocked until the new nvp resolves). i will add one more test in that file that sets NVP_TRY_NEW_DOT before SESSION and asserts closeReactNativeApp({shouldSetNVP: true}) still reaches HybridAppModule.closeReactNativeApp, which is the exact ordering that breaks today.

    What alternative solutions did you explore? (Optional)

    i looked at keeping the reset and having the nvp callback re-deliver the last value by stashing it in a separate module ref, but that adds a second source of truth and drifts away from onyx being authoritative. i also considered flipping the order of the Onyx.connectWithoutView registrations so session binds first, but that depends on native queue ordering that we shouldn't rely on, and still breaks if nvp happens to arrive mid-reset. i considered fixing at the call site by having closeReactNativeApp re-read NVP_TRY_NEW_DOT synchronously via Onyx.connect/getOnyxValue before consulting isLoadingTryNewDot, but that pushes onyx semantics into every caller and leaves the stale module state around to bite other features later.

    working branch with the fix applied: diff

  9. added a commit that references this issue on Apr 17, 2026
    994a1db
  10. JasimMalook commented on Apr 17, 2026

    @JasimMalook

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  11. github-actions commented on Apr 17, 2026

    @github-actions
    Contributor

    ⚠️ @JasimMalook 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.

  12. abzokhattab commented on Apr 17, 2026

    @abzokhattab
    Contributor

    @MelvinBot implement this

  13. 30 remaining items

  14. melvin-bot commented on May 13, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2045263129318285513/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  15. melvin-bot commented on May 15, 2026

    @melvin-bot

    @mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. mallenexpensify commented on May 15, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @abzokhattab due $250 via NewDot

    @abzokhattab plz complete the BZ checklist and tag me in a post once you have. Thx

  17. melvin-bot commented on May 19, 2026

    @melvin-bot

    @mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  18. Julesssss commented on May 20, 2026

    @Julesssss
    ContributorAuthor

    Awaiting payment

  19. mallenexpensify commented on May 21, 2026

    @mallenexpensify
    Contributor

    @abzokhattab plz complete the BZ checklist and tag me in a post once you have. Thx

  20. melvin-bot commented on May 21, 2026

    @melvin-bot

    @abzokhattab Eep! 4 days overdue now. Issues have feelings too...

  21. abzokhattab commented on May 23, 2026

    @abzokhattab
    Contributor

    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: https://github.com/Expensify/App/pull/87101/changes#r3291791274

    • [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/640780

    Regression Test Proposal

    Precondition:

    • Have a HybridApp-enabled mobile device with both OldDot and NewDot
    • NVP_TRY_NEW_DOT must be populated for the user

    Test:

    1. Launch the HybridApp on mobile
    2. Navigate to Troubleshooting settings
    3. Tap "Switch to Expensify Classic"
    4. Verify the app transitions to OldDot (does not silently do nothing)
    5. Verify this works regardless of whether NVP_TRY_NEW_DOT fires before or after the SESSION callback

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-5764-a7c0-9fae-122061e24834
  22. abzokhattab commented on May 23, 2026

    @abzokhattab
    Contributor
  23. quinthar commented on Jun 13, 2026

    @quinthar
    Contributor

    Approved $250 to @abzokhattab

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineeringExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions