Skip to content

Add Retry button to "Something went wrong" error states - #96955

Merged
lakchote merged 13 commits into
mainfrom
claude-retryButtonErrorState
Jul 28, 2026
Merged

Add Retry button to "Something went wrong" error states#96955
lakchote merged 13 commits into
mainfrom
claude-retryButtonErrorState

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The "Something went wrong" error state was a dead end: BlockingView (and its FullPageErrorView wrapper) only supported an icon, title, subtitle and an optional inline link, so a failed request left the user stranded with no way to re-attempt it.

This adds an optional CTA button to BlockingView via two new props (buttonTranslationKey + onButtonPress), rendered with ButtonComposed only when both are provided so every existing consumer is unchanged. FullPageErrorView threads the same two props through. A Retry button (reusing the existing common.tryAgain label) is then wired into the two error surfaces:

  • Spend over time widget: the search call already fired on mount in onConfigChanged (a useEffectEvent, so it can't be returned from the hook) is extracted into a plain retry function that keeps the existing !queryJSON || isSearchLoading || isOffline guard. onConfigChanged now just calls retry(), and the hook returns retry for the ERROR BlockingView.
  • Full Search page: the retry is routed through handleSearch, which resets searchRequestResponseStatusCode to null before re-firing the search. The button is intentionally hidden for INVALID_SEARCH_QUERY errors (both props left undefined), since retrying an invalid query won't help.

Fixed Issues

$ #96380
PROPOSAL: #96380 (comment)

Tests

  1. Open the browser console on dev.new.expensify.com and run Onyx.merge('network', {shouldFailAllRequests: true}).
  2. Go to the homepage and locate the Spend over time widget — reload/navigate back to it until it fails to load.
  3. Verify the widget shows the "Something went wrong" error state with a Try again button below the subtitle.
  4. In the console, run Onyx.merge('network', {shouldFailAllRequests: false}), then tap Try again.
  5. Verify the widget re-fetches and renders the chart, with no console errors.
  6. Run Onyx.merge('network', {shouldFailAllRequests: true}) again, open the Search page (any saved search).
  7. Verify the full-page error state shows with a Try again button.
  8. Run Onyx.merge('network', {shouldFailAllRequests: false}), tap Try again.
  9. Verify the search re-runs and results load in place, with no console errors.
  10. Trigger an invalid-query search error (e.g. a malformed advanced filter) and verify the error state shows without a Try again button (retrying an invalid query can't help).
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  • Open the browser console on staging.new.expensify.com and run Onyx.merge('network', {shouldFailAllRequests: true}) or enable Simulate failing network requests via Test Preferences.
  • Go to the homepage and locate the Spend over time widget — reload/navigate back to it until it fails to load.
  • Verify the widget shows the "Something went wrong" error state with a Try again button below the subtitle.
  • In the console, run Onyx.merge('network', {shouldFailAllRequests: false}), then tap Try again.
  • Verify the widget re-fetches and renders the chart, with no console errors.
  • Run Onyx.merge('network', {shouldFailAllRequests: true}) again, open the Search page (any saved search).
  • Verify the full-page error state shows with a Try again button.
  • Run Onyx.merge('network', {shouldFailAllRequests: false}), tap Try again.
  • Verify the search re-runs and results load in place, with no console errors.
  • Trigger an invalid-query search error (e.g. a malformed advanced filter) and verify the error state shows without a Try again button (retrying an invalid query can't help).

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
      • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videosundefined

Co-authored-by: Lucien Akchoté <lakchote@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Neither failing check is caused by this PR's code — no code fix is needed.

  • test (job 7) — this is an infrastructure failure, not a test failure. The job exited with code 143 (SIGTERM) after The runner has received a shutdown signal. Every test that actually ran in the job passed (e.g. ClearReportActionErrorsUITest, chunkLoadErrorRecoveryTest), and all other test shards (jobs 1–6, 8) plus typecheck passed. Just re-run the failed job to clear it (gh run rerun 30092021033 --failed, or "Re-run failed jobs" in the Actions UI) — I don't have permission to trigger the re-run from here.
  • PR Author Checklist / checklist — expected/red until the human co-author fills out the checklist, Tests, and QA sections in the PR body. This is human-only and I intentionally don't complete it on someone's behalf.
Evidence

test (job 7) log tail:

PASS tests/ui/ClearReportActionErrorsUITest.tsx (106.087 s)
PASS tests/unit/chunkLoadErrorRecoveryTest.ts
##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
##[error]Process completed with exit code 143.

checklist log: You completed 0 out of 38 checklist items with 38 unfinished items.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

There's no code fix to push here — both red checks are non-code failures, confirmed again just now:

  • test (job 7) — infrastructure, not a test failure. Every test in the shard passed, then the job was killed with exit code 143 after The runner has received a shutdown signal. All other shards (jobs 1–6, 8) and typecheck pass. This just needs the job re-run — I don't have permission to trigger the re-run from here, so please hit "Re-run failed jobs" in the Actions run (or gh run rerun 30092021033 --failed).
  • PR Author Checklist / checklist — expected red until the human co-author fills out the checklist, Tests, and QA sections. I don't complete it on someone's behalf.

@lakchote lakchote assigned linhvovan29546 and unassigned lakchote Jul 24, 2026

@linhvovan29546 linhvovan29546 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot Please check the request changes

Comment thread src/components/Search/index.tsx Outdated
Comment on lines +945 to +958
buttonTranslationKey={isInvalidQuery ? undefined : 'common.tryAgain'}
onButtonPress={
isInvalidQuery
? undefined
: () =>
handleSearch({
queryJSON,
searchKey: currentSearchKey,
offset,
shouldCalculateTotals,
prevReportsLength: filteredDataLength,
isLoading: !!searchResults?.search?.isLoading,
})
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isInvalidQuery is checked twice for two sibling props. Could be simplified via a spread ({...(!isInvalidQuery && {buttonTranslationKey: 'common.tryAgain', onButtonPress: retryHandler })}) to reduce duplication

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — collapsed the two isInvalidQuery checks into a single conditional spread so the button props are set together only when the error is retryable: src/components/Search/index.tsx:946.

<Button
style={styles.mt4}
onPress={onButtonPress}
sentryLabel="BlockingViewRetryButton"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add sentryLabel to CONST, like the other SENTRY_LABEL constants RETRY_BUTTON

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — added SENTRY_LABEL.BLOCKING_VIEW.RETRY_BUTTON to CONST (src/CONST/index.ts:8395) and referenced it in the button (src/components/BlockingViews/BlockingView.tsx:204) instead of the inline string.

…exit 143)

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only substantive failing check was test (job 7) (Jest Unit Tests), and it was not a real test failure — it was an infrastructure interruption.

Root cause: The job ended with ##[error]The runner has received a shutdown signal... Process completed with exit code 143. (SIGTERM). Every test that ran in that shard passed before the runner was terminated mid-suite — this is a spot-runner eviction, not a failure in this PR's code. None of the 5 changed files (BlockingView.tsx, FullPageErrorView.tsx, Search/index.tsx, SpendOverTimeSectionContent.tsx, useSpendOverTimeData.ts) are implicated.

The other two red checks — PR Author Checklist and PR Reviewer Checklist — are human-completed checklists, not code checks, so I left those alone.

What I did: Since no code fix was warranted, I pushed an empty commit to re-trigger CI (the direct job re-run wasn't available to me here). The test workflow should now run clean.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

All automated checks are green or currently re-running — there's no code fix needed.

  • The earlier red check, test (job 7), was a runner shutdown (exit 143, SIGTERM), not a test failure. Every test that ran had passed. I already re-triggered CI in my previous run, and that shard is now re-running and pending.
  • The only remaining red check is PR Author Checklist, which is completed by a human author — not something I can or should fix by pushing code.

To clear the last check: please complete the PR Author Checklist items in the PR description (check off the boxes and fill in the Tests/QA sections). Nothing else needs a code change.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

✅ The real failure is resolved. After I re-triggered CI, test (job 7) now passes — along with every other Jest shard that has finished — confirming the earlier red was an infrastructure interruption (the runner was killed mid-suite with exit code 143 / SIGTERM), not anything in this PR's code. The remaining test shard and perf jobs are still running but are on track.

The only check still showing red is PR Author Checklist (checklist), which is a human-completed checklist, not an automated code check — I can't tick those boxes on your behalf. Once you fill out the checklist (and the Tests/QA sections), it'll go green.

No code changes were needed for the check failure.

MelvinBot and others added 2 commits July 25, 2026 11:38
…y props via spread

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

The re-trigger cleared the earlier test (job 7) infra interruption (it now passes). This run surfaced a different, unrelated flaky failure, so no code fix is warranted here either.

Failing check: test (job 4) — one test in tests/actions/IOUTest/SplitTest.ts (setDraftSplitTransaction › should not change the tax › if there are no tax expense rules) timed out (Exceeded timeout of 240000 ms for a test). The full IOU suite ran 256s and one test blew the 240s per-test limit — a load/timeout flake, not an assertion failure. The other 2,781 tests passed.

This is unrelated to this PR, which only touches BlockingView.tsx, FullPageErrorView.tsx, Search/index.tsx, SpendOverTimeSectionContent.tsx, and useSpendOverTimeData.ts — none of which the IOU split/tax test exercises.

The only other red check, PR Author Checklist, is a human-completed checklist, not a code check.

What I did: Pushed an empty commit to re-trigger CI. If SplitTest.ts times out again on the re-run, it's a known-flaky suite rather than anything in this PR — safe to re-run/merge on green.

MelvinBot and others added 2 commits July 25, 2026 11:42
…to claude-retryButtonErrorState

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
…to claude-retryButtonErrorState

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Addressed both review comments and pushed to the branch:

  1. src/components/BlockingViews/BlockingView.tsx — added SENTRY_LABEL.BLOCKING_VIEW.RETRY_BUTTON to CONST and referenced it instead of the inline "BlockingViewRetryButton" string.
  2. src/components/Search/index.tsx — collapsed the duplicated isInvalidQuery checks into a single conditional spread ({...(!isInvalidQuery && { buttonTranslationKey, onButtonPress })}) so the retry button props are set together only for retryable errors.
Checks run
  • npm run fmt (oxfmt) — applied
  • npm run typecheck — no errors in the changed files (the failures reported were pre-existing and unrelated: missing react-native-nitro-fetch module and ResultMetadata Onyx type mismatches)
  • npm run lint-changed — passed
  • npm run react-compiler-compliance-check checkSearch/index.tsx was already grandfathered as non-compliant on main; my change produces the identical set of errors (verified against the pre-change baseline), so it introduces no new regression or memoization divergence

I did not run the full npm test / Storybook smoke suite — the changes are behavior-preserving refactors (a CONST extraction and a JSX-prop spread), with no logic change.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 6 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

1 similar comment
@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 6 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Both requested changes are addressed and pushed (4cdab0f5):

  1. Simplify the duplicated isInvalidQuery check — the two sibling props are now set together via a single conditional spread, so they only apply when the error is retryable: src/components/Search/index.tsx:946.
  2. Add a sentryLabel CONST — added SENTRY_LABEL.BLOCKING_VIEW.RETRY_BUTTON (src/CONST/index.ts:8395) and wired it into the button in place of the inline string (src/components/BlockingViews/BlockingView.tsx:204).

linhvovan29546 — ready for another look whenever you have a moment.

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (ø)
src/components/BlockingViews/BlockingView.tsx 100.00% <100.00%> (ø)
src/components/BlockingViews/FullPageErrorView.tsx 94.11% <100.00%> (+4.11%) ⬆️
src/hooks/useSearchPageSetup.ts 93.33% <100.00%> (+1.33%) ⬆️
...endOverTimeSection/SpendOverTimeSectionContent.tsx 0.00% <0.00%> (ø)
src/pages/Search/SearchPage.tsx 86.53% <60.00%> (+0.26%) ⬆️
src/pages/Search/SearchPageNarrow/index.tsx 68.88% <50.00%> (ø)
.../home/SpendOverTimeSection/useSpendOverTimeData.ts 38.70% <0.00%> (-1.30%) ⬇️
src/components/Search/index.tsx 46.13% <40.00%> (-0.08%) ⬇️
... and 105 files with indirect coverage changes

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot I think we should add bottom padding to the Try again button in SpendOverTimeSection. Currently, the button is missing bottom padding.
Screenshot 2026-07-25 at 21 37 33

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Good catch — added bottom padding to the error state so the Try again button no longer sits flush against the widget's bottom edge (bca3e94).

BlockingView vertically centers its content, and the CTA button only has top spacing (mt4), so it extended to the bottom of the fixed-height widget. Added styles.pb5 to the ERROR BlockingView's containerStyle — scoped to just this state so the offline view and other consumers are unchanged: SpendOverTimeSectionContent.tsx:82.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Please update the test section and QA test to

- Open the browser console on dev.new.expensify.com and run Onyx.merge('network', {shouldFailAllRequests: true}).
- Go to the homepage and locate the Spend over time widget — reload/navigate back to it until it fails to load.
- Verify the widget shows the "Something went wrong" error state with a Try again button below the subtitle.
- In the console, run Onyx.merge('network', {shouldFailAllRequests: false}), then tap Try again.
- Verify the widget re-fetches and renders the chart, with no console errors.
- Run Onyx.merge('network', {shouldFailAllRequests: true}) again, open the Search page (any saved search).
- Verify the full-page error state shows with a Try again button.
- Run Onyx.merge('network', {shouldFailAllRequests: false}), tap Try again.
- Verify the search re-runs and results load in place, with no console errors.
- Trigger an invalid-query search error (e.g. a malformed advanced filter) and verify the error state shows without a Try again button (retrying an invalid query can't help).

@linhvovan29546

linhvovan29546 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
telegram-cloud-document-5-6280350773645680724.mp4
telegram-cloud-document-5-6280350773645680728.mp4
Android: mWeb Chrome
telegram-cloud-document-5-6280350773645680727.mp4
iOS: HybridApp
Screen.Recording.2026-07-25.at.22.48.21.mov
iOS: mWeb Safari Simulator Screenshot - iPhone 16 Pro Max - 2026-07-25 at 22 15 08 Simulator Screenshot - iPhone 16 Pro Max - 2026-07-25 at 22 15 14
MacOS: Chrome / Safari
Screen.Recording.2026-07-25.at.21.59.19.mov
Screen.Recording.2026-07-25.at.21.46.42.mov

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the Tests and QA Steps sections of the PR description with the steps you provided (kept the "no console errors" checkbox on each). Take a look and let me know if anything needs tweaking.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Please complete the PR Author checklist, just like I did in my review #96955 (comment)

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Looks pretty good to me. cc @Expensify/design for eyes as well

@dannymcclain

Copy link
Copy Markdown
Contributor

Looking good to me too. Can we double check the spacing though? It looks a little spread out to me compared to our other empty states.

This is our standard spacing for these:
CleanShot 2026-07-27 at 08 38 13@2x

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Please address this comment #96955 (comment)

Drive the retry button's spacing from the container gap instead of stacking a hardcoded mt4 on top of it (which produced a 36px gap in the Spend over time widget), and apply the widget's gap5 + mt0/mb2 spacing to FullPageErrorView so both error surfaces match the standard 20/8/20 (icon/title/subtitle/button) empty-state spacing.

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Good catch — the button was doubling up its spacing. Fixed in eee5c92 so both error surfaces now use the standard 20 / 8 / 20 (icon → title → subtitle → button).

What was off
  • Spend over time widget: the container already applies gap5 (20px) between the icon, text block, and button, but the button also carried a hardcoded styles.mt4 (16px) — stacking to a 36px subtitle → button gap.
  • Full Search page (FullPageErrorView): had no container gap and relied on notFoundTextHeader's marginVertical: 20, giving 20 / 20 / 16.

Changes:

  • BlockingView.tsx: dropped the button's styles.mt4 so its spacing comes purely from the container gap (20px), matching the standard.
  • FullPageErrorView.tsx: applied the same gap5 + titleStyles={[mt0, mb2]} the widget already uses, so title → subtitle is now 8px (was 20px) and subtitle → button is 20px (was 16px).

notFoundTextHeader is shared by many other not-found screens, so I scoped the change to these two error views rather than touching the shared style.

Could you re-check the spacing when you get a chance? I wasn't able to run it locally, so a quick visual confirm would be great.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eee5c92a94

ℹ️ 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".

Comment on lines +949 to +950
{...(!isInvalidQuery && {
buttonTranslationKey: 'common.tryAgain',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Tie invalid-query detection to the page-level request

When a malformed search is submitted through searchInServer or opened directly, useSearchPageSetup fires the request without updating searchRequestResponseStatusCode; that state therefore remains null (or can retain the status from a previous query). Consequently isInvalidQuery is false and this spread displays a Retry button that only repeats the invalid request—or, with a stale invalid status, hides Retry for a later retriable failure. Persist or propagate the response code from the page-level request and associate it with the current query before deciding whether to render the button.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot Please address this comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — this was a real gap. Fixed in 6ecc256.

Root cause: searchRequestResponseStatusCode was only maintained on the user-driven re-search path (handleSearchAction). The page-level fire in useSearchPageSetup.ts:76 — which runs on initial mount / deep link / query change — fired search() without capturing the resolved jsonCode, and the state was never reset when the query changed. So exactly the two failure modes you flagged:

  1. An invalid query opened directly left the status at nullisInvalidQuery false → a pointless Try again was shown that just repeats the invalid request.
  2. A stale INVALID_SEARCH_QUERY from a previous query hid Try again on a later retriable failure.

(The dedup in search() made this worse: whichever fire path won the in-flight dedup returned the promise, so the component-level .then was frequently skipped entirely — Search.ts:960-963.)

Fix: made useSearchPageSetup the single source of truth for the response code, so it's tied to the current query regardless of which path fires the request:

  • The page-level fire now captures the jsonCode: useSearchPageSetup.ts:92-94.
  • The code resets on query (hash) change, so a stale INVALID_SEARCH_QUERY can't leak into the next query: useSearchPageSetup.ts:44-51 (adjusted during render rather than in an effect, per the react-hooks/set-state-in-effect rule).
  • Both SearchPage (wide) and SearchPageNarrow now consume this one value/setter instead of keeping their own separate useState, so the user-driven re-search feeds the same source of truth: SearchPage.tsx:51, SearchPageNarrow/index.tsx:161-171.
Checks run
  • npm run fmt (oxfmt) — applied
  • npm run typecheck-tsgo — no new errors in the changed files (the react-native-nitro-fetch / ResultMetadata errors are pre-existing and unrelated)
  • npm run lint-changed — 0 errors on the changed files (the one remaining warning is the pre-existing grandfathered setIsSorting in SearchPage.tsx)
  • npm run react-compiler-compliance-check check on all three files — passes (exit 0)

I wasn't able to run the invalid-query / failing-network flow locally, so a quick functional confirm of both scenarios (invalid query → no Retry; retriable failure after a prior invalid query → Retry shown) would be great.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing...

@linhvovan29546

Copy link
Copy Markdown
Contributor

@dannymcclain Does this work for you?
Screenshot 2026-07-27 at 21 17 29

Screenshot 2026-07-27 at 21 18 05

@dannymcclain

Copy link
Copy Markdown
Contributor

Yeah that looks good, thanks!

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Please resolve conflicts

…orState

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>

# Conflicts:
#	src/hooks/useSearchPageSetup.ts
#	src/pages/Search/SearchPage.tsx
#	src/pages/Search/SearchPageNarrow/index.tsx
#	src/pages/home/SpendOverTimeSection/useSpendOverTimeData.ts
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Resolved the merge conflicts and pushed the merge commit (0fde4de).

Four files conflicted, all in the Search area. Here's how each was resolved:

  • src/hooks/useSearchPageSetup.ts — kept this PR's searchRequestResponseStatusCode state + per-hash reset. main had only reworded the comment on the following lines, which this PR's version already supersedes.
  • src/pages/Search/SearchPage.tsx — combined both sides: kept this PR's destructured useSearchPageSetup(...) return and added main's new useSeedMyExpensesSearch() call.
  • src/pages/Search/SearchPageNarrow/index.tsx — kept this PR's new searchRequestResponseStatusCode/setSearchRequestResponseStatusCode props and dropped the now-stale metadata prop, which main removed (its only use was replaced by isSearchPending(searchResults)).
  • src/pages/home/SpendOverTimeSection/useSpendOverTimeData.ts — kept this PR's retry extraction but adopted main's simplified guard if (!queryJSON || isOffline), since main removed the isSearchLoading variable the old guard referenced.

Verified after resolving: no conflict markers remain, npm run typecheck-tsgo, npm run lint-changed, and npm run fmt all pass.

Please double-check the resolutions above — especially dropping metadata in SearchPageNarrow and the guard change in useSpendOverTimeData — since both merged overlapping logic from main.

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Good catch, Danny!

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Please resolve the spell check https://github.com/Expensify/App/actions/runs/30282117282/job/90030839005?pr=96955

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Fixed the failing spellcheck.

CSpell flagged one unknown word — retriable in a comment in src/hooks/useSearchPageSetup.ts:42. Changed it to retryable, which is the spelling already used (and passing CI) elsewhere in the codebase (e.g. src/libs/Reauthentication.ts, src/libs/Network/MainQueue.ts). It's a comment-only change, so there's no behavior impact.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@lakchote This should be ready for your review.

@lakchote lakchote left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some suggestions @linhvovan29546 please accept them


const searchDataType = useMemo(() => (shouldUseLiveData ? CONST.SEARCH.DATA_TYPES.EXPENSE_REPORT : searchResults?.search?.type), [shouldUseLiveData, searchResults?.search?.type]);
const shouldCalculateTotals = useSearchShouldCalculateTotals(currentSearchKey, hash, offset === 0, areAllMatchingItemsSelected);
// Retrying a failed page always resets pagination to the first page, so totals eligibility

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put an empty line before the comment unless it’s on the first line of a block.

Suggested change
// Retrying a failed page always resets pagination to the first page, so totals eligibility
// Retrying a failed page always resets pagination to the first page, so totals eligibility

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2f3ee38 — added the blank line before the comment.

isBreakLine: shouldUseNarrowLayout,
})}
subtitle={translate(isInvalidQuery ? 'errorPage.wrongTypeSubtitle' : 'errorPage.subtitle')}
// Retrying an invalid query won't help, so the retry button is only offered for other errors.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Retrying an invalid query won't help, so the retry button is only offered for other errors.
// Retrying an invalid query won't help, so the retry button is only offered for other errors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't apply this one — the blank line sits between two JSX attributes (subtitle= and the comment), and oxfmt strips blank lines inside a JSX attribute list. I added it and re-ran npm run fmt, which removed it again, so committing it would just fail the Oxfmt CI check. The comment is left directly under the subtitle prop without the leading blank line.

queryJSON?: SearchQueryJSON;
searchResults?: SearchResults;
isMobileSelectionModeEnabled: boolean;
/** jsonCode of the current query's most recent SEARCH response (owned by useSearchPageSetup in the parent). */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is useless, variable is self-explanatory

Suggested change
/** jsonCode of the current query's most recent SEARCH response (owned by useSearchPageSetup in the parent). */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2f3ee38 — removed the comment.

isMobileSelectionModeEnabled: boolean;
/** jsonCode of the current query's most recent SEARCH response (owned by useSearchPageSetup in the parent). */
searchRequestResponseStatusCode: number | null;
/** Setter for the response status code, so user-driven re-searches update the same source of truth. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is useless

Suggested change
/** Setter for the response status code, so user-driven re-searches update the same source of truth. */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2f3ee38 — removed the comment.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Please address the review suggestions #96955 (review)

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 linhvovan29546 addressed lakchote's review suggestions in 2f3ee38.

npm run fmt and npm run lint-changed pass (0 errors; the remaining lint warnings are pre-existing grandfathered ones). Changes are comment-only, so no behavior impact.

@linhvovan29546

Copy link
Copy Markdown
Contributor

Left some suggestions @linhvovan29546 please accept them

Done

@lakchote lakchote left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lakchote

Copy link
Copy Markdown
Contributor

@linhvovan29546 next time please accept my suggestions directly, so we both get credit for it.

@lakchote
lakchote merged commit 697e25d into main Jul 28, 2026
45 checks passed
@lakchote
lakchote deleted the claude-retryButtonErrorState branch July 28, 2026 14:44
@github-actions

Copy link
Copy Markdown
Contributor

🚧 lakchote has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants