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 2025-05-22] [$250] mWeb - Device´s back button has to be used twice to return from chat to inbox after a search #58946
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 9.1.17-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers):ibellicotest+437@gmail.com Issue reported by: Applause Internal Team Device used: Motorola MotoG60 - Android 12 - Chrome App Component: Other
Action Performed:
Open the staging.new.expensify.com website.
Open any chat.
Tap on the search icon on the top right corner.
Tap on "Search on this chat"
Write any word that will trigger a result.
When redirected to result, use device´s back button to return to chat.
Use device´s back button to return to inbox.
Check if you are automatically redirected to inbox or if device´s back button has to be used again.
Open the chat again and tap on the search icon.
Select any chat from the list displayed.
Use device´s back button to return to previous chat,
Use device´s back button to return to inbox.
Check if you are automatically redirected to inbox or if device´s back button has to be used again.
Expected Result:
When returning to chat after a search, using device´s back button should redirect to inbox.
Actual Result:
User has to use device´s back button twice to navigate from chat to inbox after returning from a search.
But, in case of this bug, the window.history.back() isn’t called, leaving two identical states in the history. This forces the user to hit the back button twice to return to the inbox screen.
But why the window.history.back() is not called? The key issue is that window.history.back() is wrapped inside the hideModal function:
hideModal only triggers after the modal successfully closes. By that point, the current window.history.state isn’t the report screen (step 2) anymore — it’s now the reports page (step 6), which lacks the (window.history.state as WindowState)?.shouldGoBack flag. As a result, window.history.back() never fires.
What changes do you think we should make in order to solve the problem?
We should call the window.history.back() before the user navigates to the report screen:
if ((window.history.state as WindowState)?.shouldGoBack) {
window.history.back();
}
setTimeout(()=>{
if (item?.reportID) {
Navigation.navigateToReportWithPolicyCheck({reportID: item?.reportID});
} else if ('login' in item) {
navigateToAndOpenReport(item.login ? [item.login] : [], false);
}
}, 0)
Because the bug only appears if isMobileChrome(), so only apply the change if isMobileChrome(). And consider applying the change in here.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
It is platform specific issue, can't add the test.
What alternative solutions did you explore? (Optional)
We can create a backHistory function:
functionbackHistory(){returnnewPromise((resolve)=>{constonPopState=()=>{window.removeEventListener('popstate',onPopState);resolve?.();};window.addEventListener('popstate',onPopState);// Trigger the back navigationwindow.history.back();});}
changed the title [-]mWeb - Device´s back button has to be used twice to return from chat to inbox after a search[/-][+][$250] mWeb - Device´s back button has to be used twice to return from chat to inbox after a search[/+]on Mar 24, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.45-21 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@ahmedGaber93@NicMendonca@ahmedGaber93 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]
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[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:
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
[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:
Regression Test Proposal
Test:
Android chrome only
Open ND.
Open any chat.
Tap on the search icon on the top right corner.
Tap on "Search on this chat"
Write any word that will trigger a result.
When redirected to result, use device´s back button to return to chat.
Use device´s back button to return to inbox.
Verify: You are automatically redirected to inbox.
Open the chat again and tap on the search icon.
Select any chat from the list displayed.
Use device´s back button to return to previous chat,
Use device´s back button to return to inbox.
Verify: You are automatically redirected to inbox.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Mar 22, 2025
Triggered auto assignment to @NicMendonca (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.truph01 commentedon Mar 22, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-03-22 09:17:48 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
In
SearchRouterModal, theshouldHandleNavigationBackprop is used:App/src/components/Search/SearchRouter/SearchRouterModal.tsx
Line 39 in 8deddfa
This prop pushes a new state that looks almost identical to the current state:
App/src/components/Modal/index.tsx
Line 51 in 8deddfa
App/src/components/Modal/index.tsx
Line 27 in 8deddfa
But, in case of this bug, the
window.history.back()isn’t called, leaving two identical states in the history. This forces the user to hit the back button twice to return to the inbox screen.But why the
window.history.back()is not called? The key issue is thatwindow.history.back()is wrapped inside thehideModalfunction:App/src/components/Modal/index.tsx
Line 23 in 8deddfa
hideModalonly triggers after the modal successfully closes. By that point, the currentwindow.history.stateisn’t the report screen (step 2) anymore — it’s now the reports page (step 6), which lacks the(window.history.state as WindowState)?.shouldGoBackflag. As a result,window.history.back()never fires.What changes do you think we should make in order to solve the problem?
window.history.back()before the user navigates to the report screen:App/src/components/Search/SearchRouter/SearchRouter.tsx
Line 220 in 8deddfa
App/src/components/Search/SearchRouter/SearchRouter.tsx
Lines 277 to 281 in 3f97d5e
isMobileChrome(), so only apply the change ifisMobileChrome(). And consider applying the change in here.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
And update:
App/src/components/Search/SearchRouter/SearchRouter.tsx
Lines 274 to 280 in 8deddfa
App/src/components/Search/SearchRouter/SearchRouter.tsx
Line 220 in 8deddfa
melvin-bot commentedon Mar 24, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021904248795597596858
[-]mWeb - Device´s back button has to be used twice to return from chat to inbox after a search[/-][+][$250] mWeb - Device´s back button has to be used twice to return from chat to inbox after a search[/+]melvin-bot commentedon Mar 24, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ahmedGaber93 (
External)65 remaining items
melvin-bot commentedon May 15, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon May 15, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.45-21 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 2025-05-22. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon May 15, 2025
@ahmedGaber93 @NicMendonca @ahmedGaber93 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]
NicMendonca commentedon May 23, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[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:
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
NicMendonca commentedon May 23, 2025
Payment summary
Contributor: @truph01 - $250 paid via Upwork (✅ done!)
Contributor +: @ahmedGaber93 - $250 paid via NewExpensify
ahmedGaber93 commentedon May 25, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[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: https://github.com/Expensify/App/pull/51032/files#r2106293865
[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:
Regression Test Proposal
Test:
Android chrome only
Do we agree 👍 or 👎
NicMendonca commentedon May 26, 2025
Payment summary
Contributor: @truph01 - $250 paid via Upwork (✅ done!)
Contributor +: @ahmedGaber93 - $250 paid via NewExpensify
JmillsExpensify commentedon Jul 11, 2025
$250 approved for @ahmedGaber93