Fix distance waypoint "Not here" after Scan receipt then Track distan…#94772
Open
oqildev wants to merge 2 commits into
Open
Fix distance waypoint "Not here" after Scan receipt then Track distan…#94772oqildev wants to merge 2 commits into
oqildev wants to merge 2 commits into
Conversation
…ce shortcut Launcher quick-action deeplinks (the home-screen "Scan receipt" / "Track distance" shortcuts) enter NewDot through IOURequestRedirectToStartPage, which navigates straight to the per-request route without going through startMoneyRequest. A previous shortcut's draft therefore survived under OPTIMISTIC_TRANSACTION_ID; a leftover "scan" draft has no comment.waypoints, so the distance start page showed placeholder Start/Stop waypoints (rendered locally) while the waypoint editor read the empty waypoints from Onyx and rendered the "Not here" page. Clear the stale draft in the redirect (mirroring startMoneyRequest) so the destination start page rebuilds a fresh draft with the correct shape, including the distance start/stop waypoints. The OPTIMISTIC_TRANSACTION_ID fallback covers the cold-start case where the draft collection has not hydrated yet. Add a regression test that fails without the fix. Expensify#88183
|
@ChavdaSachin Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f62f38b10
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…e-init - codex P1: `validTransactionDraftIDsSelector` returns `[]` (not `undefined`) before the draft collection hydrates, so the clear must always include OPTIMISTIC_TRANSACTION_ID. A `?? [...]` fallback alone passed an empty list on a cold start / hard-refresh and removed nothing, letting the stale scan draft survive. - PERF-16: guard the empty-dependency effect with a per-mount `useRef` so the non-idempotent `clearMoneyRequest` + redirect run exactly once under Strict Mode's dev double-invoke. A module-level flag would be wrong here — this page remounts on every quick-action deeplink, so a flag that never resets would block every shortcut after the first. - Add a regression test for the empty-selector (cold-start) case.
2c4decc to
a1018ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
Launcher quick-action deeplinks (the home-screen "Scan receipt" / "Track distance" shortcuts) enter NewDot through
IOURequestRedirectToStartPage, which navigates straight to the per-request route without going throughstartMoneyRequest. A previous shortcut's draft therefore survived underOPTIMISTIC_TRANSACTION_ID; a leftover "scan" draft has nocomment.waypoints, so the distance start page showed placeholder Start/Stop waypoints (rendered locally) while the waypoint editor read the empty waypoints from Onyx and rendered the "Not here" page.This clears the stale draft in the redirect (mirroring
startMoneyRequest) so the destination start page rebuilds a fresh draft with the correct shape, including the distance start/stop waypoints. TheOPTIMISTIC_TRANSACTION_IDfallback covers the cold-start case where the draft collection has not hydrated yet. A regression test that fails without the fix is added.Fixed Issues
$ #88183
PROPOSAL: #88183 (comment)
Tests
mWeb/Web (no home-screen shortcut): open
/start/create/scan, hard-refresh the page, then open/start/create/distance-map, and tap the Start (or Stop) waypoint. Verify the editor opens.Offline tests
Same steps as in Tests.
clearMoneyRequestis a synchronous OnyxmultiSetwith no network involvement, so the fix behaves identically while offline (the waypoint editor opens instead of the "Not here" page).QA Steps
Same as Tests above.
mWeb/Web: open
/start/create/scan, hard-refresh the page, then open/start/create/distance-map, and tap the Start (or Stop) waypoint. Verify the editor opens.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.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
distance-scan-fix.mov
Android: mWeb Chrome
android.-.mweb.mp4
iOS: Native
ios-distance-.mp4
iOS: mWeb Safari
ios.-.mweb.MOV
MacOS: Chrome / Safari
web.-.distance.mp4