Fix console error when opening a newly created expense on the Spend page#95670
Conversation
Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
Per MelvinBot policy I can't tick the author checklist or fill out the human Every code-relevant check is green. I verified the two most likely to catch this change locally against the changed file (
All other CI jobs are passing. When I finished, The failing check log |
|
@MelvinBot Ready to review |
ReviewVerdict: The code change is correct, minimal, and the root-cause reasoning holds up — the render-phase → commit-phase move is the right fix for this warning. No functional regression. Two non-code items still block merge (see below); I can't complete them myself. Why the fix is correctThe warning fires because I verified the supporting claims:
Blockers before this can merge
Every code-relevant check is green (ESLint + typecheck verified locally earlier). Once the checklist/Tests/QA are filled in, this looks good to go from a code standpoint. |
|
@MelvinBot Mark the PR ready |
|
@DylanDylann 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] |
|
Done — PR #95670 is now marked Ready for review. ✅ One heads-up: the |
|
The failing ESLint check is not related to this PR — it's a pre-existing Why it's unrelated: This PR only touches
Both files have the exact same violation counts on Merging latest Recommended fix (belongs on EvidenceThe other failing check, PR Author Checklist / |
|
@MelvinBot Got a failed Eslint check |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
The failing ESLint check is not caused by this PR — it's a broken- What's failing: the seatbelt rule in Root cause: a recent revert on Already being fixed: #95671 — "Fix ESLint seatbelt budget violations reintroduced by revert." Once that lands on I'm not pushing anything here: the fix belongs on Evidence
|
|
@MelvinBot Merge latest main |
…rPhaseSetStateWarning Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
|
🤖 Merged latest |
|
@NicolasBonet 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] |
|
@MelvinBot Please reopen this PR |
|
🤖 Done — I've reopened this PR. The head branch Note: I couldn't verify anything in the browser in this run (web verification wasn't available), but reopening required no browser interaction. |
|
@MelvinBot Please merge the latest main and mark this PR ready |
…rPhaseSetStateWarning Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
|
🤖 Done!
Note: I couldn't verify anything in a browser this run (web verification wasn't available), but merging and marking ready required no browser interaction. CI checks will run on the new merge commit — please keep an eye on them. |
|
The failing ESLint check is now passing ✅ — it was stale, not caused by this PR's changes. What was wrongThe ESLint run that failed (job) reported 6 problems, and all of them were in That failure ran on 2026-07-10 against an old snapshot of What fixed itThe branch was simply behind Remaining checkThe only check still red is Note on verificationI couldn't drive the app in a browser in this run, but that isn't needed here — this was a CI/lint issue, and I confirmed the ESLint check passes directly from the PR check status. |
|
I looked into the checks on this PR. The only failing check is The checklist job failed with:
This is the standard human author checklist from the PR template. It can't be fixed with a code change — the boxes in the PR description just need to be checked off by the author/assignee. Once every item is ticked, the check will pass on the next run. No push was needed, so I haven't made any changes. |
|
@MelvinBot Please update the test steps
|
|
🤖 Done — I've updated the Tests section of the PR body to:
(Offline tests still point to "Same as Tests.") Let me know if you'd like any further tweaks. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-07-21.at.11.07.01.movAndroid: mWeb ChromeiOS: HybridAppScreen.Recording.2026-07-21.at.11.04.48.moviOS: mWeb SafariMacOS: Chrome / Safari |
|
@NicolasBonet This PR is ready for your review. It was created by Melvin, and I'm unable to update the PR description to satisfy the author checklist |
|
I checked the current status of all checks on this PR and none of them are failing. 🟢 Every check reports Since there's nothing failing, I haven't pushed any changes. If a check was red earlier, it may have been a transient/flaky run that has since re-run green. If you're still seeing a specific red check, let me know which one (or link the failing job) and I'll dig into it. |
|
@codex review |
|
Re-checked — all checks on this PR are green. ✅ Every check now reports If you're still seeing a red check on your end, point me at the specific failing job (link the run) and I'll investigate that one directly. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@NicolasBonet All yours |
|
🚧 NicolasBonet has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/NicolasBonet in version: 9.4.42-0 🚀
|
|
🤖 No help site changes required. This PR is a dev-only fix scoped entirely to internal React rendering. It moves a parent-state update ( There's no user-facing feature, UI label, setting, tab, or workflow change here — nothing that any article under What I reviewed
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.4.42-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fixes the dev-only console error
Cannot update a component (SearchPage) while rendering a different component (Search)that appears when opening a newly created expense on the Spend page.Searchbails out to an error/empty state via conditionalreturns during render (searchResults === undefined,hasErrors, and the empty-state branch). Each of those callscancelNavigationSpans(), which — before this change — also called the parent-ownedonContentReady?.()(SearchPage'ssetIsSearchReady(true)fromuseSearchOverlay). Updating the parent's state duringSearch's render is exactly what React's warning flags.When a just-created expense is opened before its transaction lands in the search snapshot,
Searchtransiently takes the empty-state bail-out, so the render-phase parent update fires and the warning is logged.The fix moves the
onContentReady?.()call out ofcancelNavigationSpansand into the existing no-dependency post-commituseEffect(guarded by thedidBailToFallbackStateref that the bail-out paths already set). This defers the parent update to the commit phase instead of during render, matching the flush pattern already used in the same file.setIsSearchReady(true)is idempotent, so firing it on every bail-out render is safe and does not loop. Behavior is otherwise unchanged.Fixed Issues
$ #94318
PROPOSAL: #94318 (comment)
Tests
Cannot update a component (SearchPage) while rendering a different component (Search)console error does not appearOffline tests
Same as Tests.
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.