mWeb - Incorrect navigation to confirm details page & discard changes popup briefly visible#67010
Conversation
…anges popup briefly visible. Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppdiscardAndroid.movAndroid: mWeb ChromediscardAndroidmWeb.moviOS: HybridAppdiscardiOS.moviOS: mWeb SafaridiscardiOSmWeb.movMacOS: Chrome / SafaridiscardChrome.movMacOS: DesktopdiscardDesktop.mov |
MarioExpensify
left a comment
There was a problem hiding this comment.
This is really good, thank you @Krishna2323 and @c3024
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/MarioExpensify in version: 9.1.89-1 🚀
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.1.89-21 🚀
|
| onModalHide={() => { | ||
| shouldNavigateBack.current = false; | ||
| onCancel?.(); | ||
| }} |
There was a problem hiding this comment.
Coming from #75014 BugZero checklist:
This PR caused a regression where users cannot discard unsaved changes in the description field on Android mWeb when using the browser back button.
Root Cause: The onModalHide callback added in this PR creates a race condition with the InteractionManager.runAfterInteractions() in the onConfirm handler. The callback sets shouldNavigateBack.current = false immediately when the modal starts hiding, but the navigation logic is queued to run after animations complete. By the time the navigation logic executes, the flag has already been reset, causing an early return before navigation can occur.
The Issue: When users confirm "Discard changes", the modal closes but they remain on the same page with their unsaved text still in the field.
Current Fix: The fix in #76492 addresses this by:
- Adding an
isConfirmedref to track whether user confirmed or cancelled - Only resetting
shouldNavigateBack.currentwhen user cancels - Using
setNavigationActionToMicrotaskQueue()to ensure proper execution timing
Explanation of Change
Fixed Issues
$ #64107
PROPOSAL: #64107 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4