Fix stale next step after Submit upgrade + approve#94238
Draft
abzokhattab wants to merge 4 commits into
Draft
Conversation
When a Submit-tier report is approved via the UPGRADE_SUBMIT flow, the report is approved server-side but the UpgradeSubmit response does not refresh the report's next step, leaving the banner stuck on "Waiting for you to approve" until a manual reopen. Refetch the report via openReport in the approvalSubmitReport upgrade confirmation case, which fires once the submit upgrade succeeds, so the next step reflects the approved state immediately. Fixes Expensify#93686
Replace the openReport refetch workaround with optimistic Onyx updates in upgradeSubmit. When the upgrade also approves a report (the Submit "Approve report" flow), it now writes the approved report state and a refreshed next step optimistically, mirroring ApproveMoneyRequest, so the banner no longer stays stuck on "Waiting for you to approve" until a manual reopen. Includes success/failure rollback for the report and NEXT_STEP collection.
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
When a report on a Submit-tier (
submit2026) workspace is approved, approval goes through the newUpgradeSubmitserver-side flow.approveMoneyRequestdetects this and returns early (navigating to the upgrade page), so it never builds the optimistic approved action or next step. The actual approval happens server-side insideUpgradeSubmit(thereportIDis passed so the backend approves the report after upgrading), but that response does not refresh the report's next step. As a result, the Next Steps banner stays stuck on "Waiting for you to approve expenses" until the report is manually reopened (e.g. viaopenReport).This PR fills in the previously empty
approvalSubmitReportcase in the upgrade confirmation handler (WorkspaceUpgradePage) to callopenReportonce the Submit upgrade succeeds. Because that confirmation only fires after the upgrade completes server-side (the report is already approved by then), refetching the report returns the correct post-approval next step from the server — matching what a manual reopen does today — without fragile optimistic guessing.Fixed Issues
$ #93686
PROPOSAL: N/A (internal project bug fix — Bottom-Up Submit Plan)
Tests
submit2026) workspace with theSUBMIT_2026beta enabled.Offline tests
Upgrading/approving is an online-only flow (consistent with the rest of the upgrade/downgrade flows), so there is no new offline behavior. While offline, the Upgrade button is disabled and no
openReportrefresh is triggered.QA Steps
Same as the Tests section above (requires the
SUBMIT_2026beta and a Submit-tier workspace).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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari