Skip to content

[Due for payment 2026-04-28] [Due for payment 2026-03-30] Android - Chat does not open after closing chat and opening another chat from FAB #85687

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.40-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #83899
Email or phone of affected tester (no customers): sdjsdjosijnsodiosd@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Samsung Galaxy S25 FE / Android 16
App Component: Chat Report View

Action Performed:

  1. Launch Expensify app.
  2. Open FAB > Start chat.
  3. Select any user from Recents or Contacts list.
  4. Tap app back button.
  5. Open FAB > Start chat.
  6. Select any user from Recents or Contacts list.

Expected Result:

Chat report will open.

Actual Result:

Chat report does not open after closing chat report and opening another chat from FAB.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 18, 2026
  2. melvin-bot commented on Mar 18, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #83899

  3. melvin-bot commented on Mar 18, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 18, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Mar 18, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #83899 - "Migration navigation from InteractionManager to TransitionTracker V2" by @collectioneur (High confidence)
    Related Issues: Part of #71913 (TransitionTracker migration parent issue)

    Recommendation: REVERT

    PR #83899 introduces the TransitionTracker system to replace InteractionManager for handling navigation transitions. The bug occurs specifically when:

    1. Opening FAB > Start chat
    2. Selecting a user
    3. Going back (Android back button)
    4. Opening FAB > Start chat again
    5. Selecting another user
    6. The chat report fails to open

    This matches test case #4 from the PR description: "Navigate to a chat from FAB (RHP)".

    Labels: No changes needed. DeployBlockerCash is correctly applied (blocks App deploy). DeployBlocker is not present, which is correct since this is a frontend bug requiring an App revert, not a backend fix.

    📋 Detailed Analysis

    Evidence

    • The issue is only reproducible on staging, not production, confirming it was introduced in the current deploy
    • PR Migration navigation from InteractionManager to TransitionTracker V2 #83899 was explicitly mentioned in the issue by melvin-bot as the suspected cause
    • The bug affects Android-specific navigation behavior
    • The symptom (chat not opening after dismissing and reopening from FAB) directly relates to the modal dismissal and navigation changes in the PR

    Verification

    The PR modifies src/pages/NewChatPage.tsx lines 386-393:

    if (option?.reportID) {
        Navigation.dismissModal({
            afterTransition: () => {
                Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(option?.reportID));
            },
        });
        return;
    }

    The PR changed from the old callback pattern to the new afterTransition pattern. The dismissModal function now wraps the modal dismissal in TransitionTracker.runAfterTransitions, and then the afterTransition callback is scheduled with waitForUpcomingTransition: true.

    Root Cause

    The TransitionTracker system relies on transitionStart and transitionEnd events from React Navigation to properly track transitions. On Android (React Navigation Native Stack), these events may not be firing reliably, or there is a race condition where:

    1. The first modal dismissal starts a transition
    2. The afterTransition callback is queued with waitForUpcomingTransition: true, waiting for the next transition to start
    3. On the second attempt to open a chat, the transition tracking state is corrupted or the callback queue is not properly handled
    4. The navigation to the report never executes

    The issue is specific to Android because the native stack navigator on Android may have different timing characteristics than iOS or web.

  6. MelvinBot commented on Mar 18, 2026

    @MelvinBot
    Contributor

    Proposal

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

    On Android, when a user opens FAB > Start Chat, selects a user (chat opens), presses the back button, then opens FAB > Start Chat again and selects another user, the second chat report does not open. This is reproducible on staging (v9.3.40-0) but not production, confirming it was introduced by PR #83899.

    What is the root cause of that problem?

    PR #83899 replaced the synchronous callback pattern in dismissModal with the new afterTransition + waitForUpcomingTransition pattern powered by TransitionTracker.

    The flow in NewChatPage.tsx:386-393 when selecting an existing chat:

    Navigation.dismissModal({
        afterTransition: () => {
            Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(option?.reportID));
        },
    });
    

    Inside dismissModal (Navigation.ts:765-779), this dispatches DISMISS_MODAL to pop the RHP, then calls:

    TransitionTracker.runAfterTransitions({
        callback: afterTransition,
        waitForUpcomingTransition: true
    });
    

    The waitForUpcomingTransition: true flag (TransitionTracker.ts:109-114) creates an async function that awaits promiseForNextTransitionStart — it waits for the next startTransition() call before queuing the callback to run when activeCount hits 0.

    The ScreenLayout component (ScreenLayout.tsx:22-34) listens for transitionStart/transitionEnd events on each screen's navigation object and calls TransitionTracker.startTransition()/endTransition() accordingly. When a screen unmounts, the listeners are cleaned up.

    The bug mechanism on Android: When DISMISS_MODAL pops the RHP from the root stack, the native stack navigator (backed by react-native-screens Fragments) fires transition events for both the disappearing (RHP) and appearing (underlying) screens. However, on Android, the RHP's ScreenLayout component may be torn down before transitionEnd fires for the disappearing screen. This means startTransition() is called (incrementing activeCount) but the corresponding endTransition() never fires, leaving activeCount stuck at a positive value.

    While there's a 1000ms safety timeout (CONST.MAX_TRANSITION_DURATION_MS) that eventually calls decrementAndFlush(), this creates a significant delay window. On the second attempt, the accumulated transition imbalance from both the first dismiss and the back navigation means activeCount is persistently elevated. The afterTransition callback gets queued in pendingCallbacks but waits for activeCount to reach 0, which is blocked by multiple unresolved transitions. From the user's perspective, the chat simply doesn't open (or opens with such a delay that it appears broken).

    This is Android-specific because @react-navigation/native-stack on Android uses Fragment-based screen management which may detach the React component tree before the native exit animation completes its transitionEnd event, unlike iOS where UIKit preserves the component longer.

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

    Given this is a deploy blocker, the safest and fastest fix is to revert PR #83899. The TransitionTracker V2 migration has a fundamental timing issue on Android where screen unmounting can race with transition event delivery, causing unbalanced startTransition/endTransition pairs.

    If a revert is not desired, an alternative fix would be to modify ScreenLayout.tsx to call TransitionTracker.endTransition() in the useLayoutEffect cleanup function when the component unmounts during an active transition. This would ensure that any transition started by that screen is properly ended even if the transitionEnd event never fires:

    In ScreenLayout.tsx, the cleanup should detect if this screen started a transition that hasn't ended and call endTransition() to rebalance the counter. This prevents the orphaned startTransition from blocking subsequent afterTransition callbacks.

    What alternative solutions did you explore? (Optional)

    1. Adding endTransition() to ScreenLayout cleanup — This would fix the immediate imbalance but may mask other timing issues. The transitionEnd event might fire AFTER cleanup, causing a double endTransition() (though decrementAndFlush guards against activeCount < 0).
    2. Removing waitForUpcomingTransition from dismissModal — The callback could use runAfterTransitions without waitForUpcomingTransition, but this would fire the navigation before the dismiss animation completes, potentially causing visual glitches.
    3. Reverting to the old callback pattern for dismissModal only — Keep TransitionTracker for other uses but restore the synchronous callback behavior in dismissModal. This is a partial revert that targets the specific broken flow.

    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.

  7. m-natarajan commented on Mar 19, 2026

    @m-natarajan

    Issue no longer reproducible on build 9.3.40-3. Retested on Motorola Moto G60 - Android 12

    screen-20260318-224548.mp4
  8. srikarparsi commented on Mar 19, 2026

    @srikarparsi
    Contributor

    Sounds great, thank you

  9. 6 remaining items

  10. melvin-bot commented on Mar 23, 2026

    @melvin-bot

    @srikarparsi 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]

  11. melvin-bot commented on Mar 23, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  12. mallenexpensify commented on Mar 30, 2026

    @mallenexpensify
    Contributor

    If the regression penalty applies, comment on the issue linked to the PR that introduced the regression. Thx

  13. melvin-bot commented on Apr 17, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  14. changed the title [-][Due for payment 2026-03-30] Android - Chat does not open after closing chat and opening another chat from FAB[/-] [+][Due for payment 2026-04-28] [Due for payment 2026-03-30] Android - Chat does not open after closing chat and opening another chat from FAB[/+] on Apr 21, 2026
  15. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  16. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.60-22 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-04-28. 🎊

  17. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    @srikarparsi @mallenexpensify 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]

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions