Repository navigation
fix(health): surface a fetch error in TestsReachingList - #2632
Conversation
The fetcher's rejection was swallowed with .catch(() => null), which made a failed request render the same "nothing reaches this file" sentence as a genuine static-analysis answer. Let the rejection reach SWR's error state and show a distinct "could not load" message instead, so a fetch failure is never read as evidence the file is untested.
|
Reviewed the whole diff: nothing to fix. 👀 Suggested reviewers @RaghavChamadiya 📊 See the full report for this PR |
RaghavChamadiya
left a comment
There was a problem hiding this comment.
Thanks @drakeo338. Dropping the .catch(() => null) also brings the useSWR type back in line with what the fetcher prop actually promises, and the negative assertion that the empty-state text no longer renders is the check that matters. Agreed the server-side basis: "none" fold is a separate question.
Summary
TestsReachingListcaught a rejected fetch intonull, so a failed request rendered the same "no test reaches this file" sentence as a genuine empty answer. This change lets the fetch failure set an error state instead, so a 500 or a network error shows a distinct "could not load" message rather than the empty-graph answer.There's a related spot worth a separate look:
health_tests_reachingincoverage_routes.py:359still folds a graph-walk exception into the samebasis: "none"shape as a real empty answer, matching this file's own convention elsewhere, so the new client error state can't fire for that server-side case. I left it out of this PR since it would change an established convention the issue doesn't ask for, and the UI conflation this PR fixes holds regardless.Fixes #2624.
Related Issues
Fixes #2624
Test Plan
Run from
packages/ui:npx vitest run __tests__/health/inferred-tests.test.tsxpytest)ruff check .)npm run build) (if frontend changes)Checklist