Skip to content

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

Open
MelvinBot wants to merge 8 commits into
mainfrom
claude-retryButtonErrorState
Open

Add Retry button to "Something went wrong" error states#96955
MelvinBot wants to merge 8 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: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • 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 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 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)
  • 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 new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • 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.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user 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.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

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 93.33% <100.00%> (+3.33%) ⬆️
...endOverTimeSection/SpendOverTimeSectionContent.tsx 0.00% <0.00%> (ø)
.../home/SpendOverTimeSection/useSpendOverTimeData.ts 37.50% <0.00%> (-1.21%) ⬇️
src/components/Search/index.tsx 46.13% <40.00%> (-0.08%) ⬇️
... and 180 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)

@MelvinBot

Copy link
Copy Markdown
Contributor Author

linhvovan29546 — I'm not able to complete the PR Author Checklist the way the Reviewer Checklist was completed, and I want to be transparent about why rather than silently ticking boxes.

Most of the author checklist is a set of manual-testing attestations — "I ran the tests on all platforms & verified they passed on Android/iOS Native, mWeb, macOS", "I turned off my network connection and tested it offline", "I tested this PR with a High Traffic account against staging/production", "I included screenshots or videos for tests on all platforms". As the bot author I didn't run those manual device tests, so I can't honestly check those items. The Tests, Offline tests, and QA Steps sections in the PR body are also still // TODO placeholders that a human co-author needs to fill in — I intentionally don't complete those on a person's behalf.

What I can confirm about the change itself:

  • The correct issue (Expensify/App#96380) is linked in the Fixed Issues section.
  • No new copy was introduced — the button reuses the existing common.tryAgain string.
  • No new CSS style was added (reuses styles.mt4); no new assets.
  • The one added comment explains why the retry button is hidden for invalid queries.
  • The two review comments (conditional-spread simplification + BLOCKING_VIEW.RETRY_BUTTON sentry label) are addressed in 4cdab0f5.

Since BlockingView is a shared/generic component, the "tested other usages of the generic component" and cross-platform boxes really do need a human pass before they're checked. You already posted iOS/macOS artifacts in your review — if the human co-author (you or lakchote) is comfortable that the manual testing has been done, please fill in the Tests/QA sections and check the attestations off. I'm happy to tick the objective, code-level boxes above (issue link, copy, CSS/assets, comments) if you'd like me to — just confirm and I'll edit the body for those specifically.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Update the QA Steps to

- 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).

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the QA Steps section with the steps you provided. The rest of the PR body (including the Tests section) is unchanged.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@MelvinBot Please mark PR ready for review

@MelvinBot
MelvinBot marked this pull request as ready for review July 25, 2026 15:51
@MelvinBot
MelvinBot requested a review from a team as a code owner July 25, 2026 15:51
@melvin-bot

melvin-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

@dubielzyk-expensify @linhvovan29546 One of you needs to 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]

@melvin-bot
melvin-bot Bot removed request for a team July 25, 2026 15:51
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done — marked this PR as ready for review. linhvovan29546, it's all yours whenever you're ready to take another look.

@linhvovan29546

Copy link
Copy Markdown
Contributor

@dubielzyk-expensify This should be ready for you to review the design.

Screen.Recording.2026-07-25.at.21.59.19.mov
Screen.Recording.2026-07-25.at.21.46.42.mov

</SubtitleWrapper>
)}
</View>
{!!onButtonPress && !!buttonTranslationKey && (

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.

❌ CLEAN-REACT-PATTERNS-1 (docs)

This adds two new optional content props (buttonTranslationKey, onButtonPress) to BlockingView whose sole purpose is to conditionally render a UI element. Both props are used only inside this {!!onButtonPress && !!buttonTranslationKey && (<Button .../>)} block — nothing else. Per Case 2, an optional prop that exists only to gate a {!!prop && <Element />} render should be a composable child instead. Every future addition (e.g. a second action, an icon on the button) would again require expanding BlockingView's prop interface and internals, increasing coupling and regression risk.

Prefer composition so BlockingView never has to change when a consumer needs a CTA. For example, expose the button as a child the consumer opts into rather than a prop pair:

// Consumer (e.g. FullPageErrorView / SpendOverTimeSectionContent) composes the action:
<BlockingView icon={...} title={...} subtitle={...}>
    <BlockingView.Action onPress={retry}>{translate('common.tryAgain')}</BlockingView.Action>
</BlockingView>

This keeps BlockingView stable and lets each consumer decide whether (and what) to render below the subtitle without threading buttonTranslationKey/onButtonPress through FullPageErrorView as pure pass-throughs.


Reviewed at: bca3e94 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

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.

It's a legitimate, well-reasoned style point, but not a correctness bug — non-blocking for this PR.

Consistent with existing precedent. ButtonComposed (imported in this very file) explicitly documents itself as replacing "a large flat props list" with children composition, so the critique aligns with the direction the codebase is already heading, not just abstract preference.

But adopting it here is a bigger lift than it looks:

  • BlockingView needs a real children slot — it has none today. The return is a fixed ScrollView → icon/animation → title/subtitle → button, with no insertion point.
  • A new BlockingView.Action sub-component would need to be built.
  • FullPageErrorView would need to forward children instead of the two pass-through props (buttonTranslationKey, onButtonPress).
  • Both consumers (SpendOverTimeSectionContent.tsx, Search/index.tsx) would need to switch call syntax.

Scope risk: BlockingView/FullPageErrorView are used broadly across the app (dozens of consumers). Widening its public contract is the kind of change worth doing deliberately — not as a rider on an issue explicitly scoped as a "lightweight interim improvement," where a more holistic approach was called out as intentionally out of scope.

@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: bca3e94250

ℹ️ 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 thread src/components/Search/index.tsx Outdated
handleSearch({
queryJSON,
searchKey: currentSearchKey,
offset,

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 Reset pagination before retrying a failed page

When a load-more request fails, offset is already nonzero, while the failure update clears the entire snapshot with data: null in src/libs/actions/Search.ts:758. Retrying with that same offset therefore reloads only the later page into an empty snapshot, omitting the initial results; the component also retains the nonzero offset, so subsequent pagination can skip another page. Reset both the request and local pagination offset to zero when retrying this full-page error.

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 one.

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 — addressed in 8979399.

The retry now resets pagination to the first page before re-firing the search: src/components/Search/index.tsx:951. Both the request offset and the local offset state (setOffset(0)) are reset to 0, so a retry after a failed load-more refetches from the start instead of loading only the later page into the snapshot that the failure cleared with data: null (src/libs/actions/Search.ts:758).

Since retrying always returns to the first page, I also evaluate totals eligibility as if we're on page 1 (shouldCalculateTotalsOnRetry) so a retry from a paginated error still requests totals like a fresh first-page load: src/components/Search/index.tsx:184.

…e search

Co-authored-by: Linh Vo <linhvovan29546@users.noreply.github.com>
Co-authored-by: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/issues/comments#get-an-issue-comment","status":"404"} <{"message":"Not Found","documentation_url":"https://docs.github.com/rest/issues/comments#get-an-issue-comment","status":"404"}@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner July 26, 2026 04:57
@melvin-bot
melvin-bot Bot requested review from lakchote and removed request for a team July 26, 2026 04:57
@melvin-bot

melvin-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown

@dubielzyk-expensify @lakchote One of you needs to 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]

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.

3 participants