Skip to content

[Due for payment 2026-07-21] Search - Search router opens and closes when opening search with promo modal opened #93964

Closed

Description

@applause-bot

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.4.15-1
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #92007
Email or phone of affected tester (no customers): sdjnoisdjdosijsonssjo@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Other

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to https://staging.new.expensify.com/ai-features-promo.
  3. Press CMD+K.

Expected Result:

Search router will open.

Actual Result:

Search router opens and closes.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7184846_1781804413709.1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Nathan Lemma
Bug ID: 7184846

Activity

  1. applause-bot commented on Jun 18, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/bd0dd7728e3f642ea566f07b19533dbc58436b7139e3a24be05410ca580e1bee

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 18, 2026
  3. melvin-bot commented on Jun 18, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jun 18, 2026

    @melvin-bot

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

  5. github-actions commented on Jun 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.
  6. MelvinBot commented on Jun 18, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    On /ai-features-promo the promo modal is both an open Modal and a navigation route. The Search router (CMD+K) is not a navigation route — it's a React‑state overlay (isSearchRouterDisplayed) that integrates with browser history. The two collide on web:

    1. CMD+K → toggleSearch() → openSearchRouter() pushes a history entry window.history.pushState({isSearchModalOpen: true}), then calls Modal.close(cb, false, /* shouldCloseAllModals */ true).
    2. Because the promo modal is open, closing it runs FeatureTrainingModal's pendingCloseModalAction. shouldGoBack defaults to true and AIFeaturesPromoModal doesn't override it → Navigation.goBack() dismisses the /ai-features-promo route.
    3. On web, that goBack pops browser history past the {isSearchModalOpen: true} entry → fires a popstate whose state lacks isSearchModalOpen → listener sets isSearchRouterDisplayed = false.
    4. Meanwhile the modal‑close callback opened the router (setIsSearchRouterDisplayed(true)).

    Net result: the router opens, then the goBack-triggered popstate immediately closes it. This is web‑only (matches the reported platforms — Windows/MacOS Chrome/Safari), since the history/popstate path is guarded by isBrowserWithHistory/canListenPopState.

    Note: the new AIFeaturesPromoGuard is not the cause — it explicitly allows GO_BACK, and opening Search dispatches no navigation action for it to block.

    Sequence of events
    CMD+K → openSearchRouter()
      ├─ history.pushState({isSearchModalOpen: true})
      └─ Modal.close(cb, shouldCloseAllModals=true)
           └─ promo modal (FeatureTrainingModal) hides
                ├─ onModalDidClose → cb → openSearch() → isSearchRouterDisplayed = true   ← router opens
                └─ pendingCloseModalAction → Navigation.goBack() (shouldGoBack=true)
                     └─ browser history pops past {isSearchModalOpen:true}
                          └─ popstate → state has no isSearchModalOpen
                               └─ isSearchRouterDisplayed = false                          ← router closes
    

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

    Defer the search router's history push until after the existing modals finish closing, so the promo modal's goBack can't pop the router's history entry. In openSearchRouter (SearchRouterContext.tsx:98-118), move the window.history.pushState({isSearchModalOpen: true}) call inside the close(...) callback (alongside openSearch(...)), instead of before close(...).

    This is a general fix — it makes the router robust to opening on top of any modal route whose dismissal triggers a history-mutating goBack, not just this promo modal.

    What alternative solutions did you explore? (Optional)

    • Suppress CMD+K while the promo modal is up: early-return in SearchHandler when the promo navigator is topmost (like the existing isOnboardingFlow() check). Avoids the flash but blocks a legitimate action.
    • shouldGoBack={false} on the promo modal: risks breaking the modal's normal route dismissal, since /ai-features-promo relies on goBack to close.
    • Revert PR #92007: fastest deploy-blocker unblock if a fix can't land quickly, since the conflict is entirely introduced by the new promo modal route.

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/93964) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  7. IuliiaHerets commented on Jun 18, 2026

    @IuliiaHerets

    Chrome / v9.4.15-2
    Not here page opens

    bandicam.2026-06-19.00-30-19-292.mp4
  8. puneetlath commented on Jun 18, 2026

    @puneetlath
    Contributor

    Seems expected since we modal was reverted.

  9. melvin-bot commented on Jul 10, 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.

  10. lanitochka17 commented on Jul 10, 2026

    @lanitochka17

    Deploy Blocker #95856 was identified to be related to the PR #94012 that attempted to fix this issue.

  11. melvin-bot commented on Jul 10, 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.

  12. changed the title [-]Search - Search router opens and closes when opening search with promo modal opened[/-] [+][Due for payment 2026-07-21] Search - Search router opens and closes when opening search with promo modal opened[/+] on Jul 14, 2026
  13. melvin-bot commented on Jul 14, 2026

    @melvin-bot

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

  14. melvin-bot commented on Jul 14, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.33-8 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-07-21. 🎊

  15. melvin-bot commented on Jul 14, 2026

    @melvin-bot

    @mjasikowski 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]. If no checklist is needed for this issue, you can click: [no checklist button]

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

Metadata

Metadata

Assignees

Labels

BugSomething 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