Repository navigation
Conversation
`Result` decided whether a result was an error from the response body alone. A request that failed without one (a timeout, a network error, a response that is not JSON) left `data` undefined, so the panel stayed collapsed and its header showed the success icon and "Completed in 0 seconds". The error message built from `error` was never shown. Treat any query error as an error result, so the panel expands with the error message and the header shows the error icon. A requery that fails after a successful query now shows its error instead of the old output. A timeout reaches `Result` as an `AbortError` whose message doesn't mention the timeout, so it showed "This Operation Was Aborted" instead of the configured `messages.requestTimeout`. Map `AbortError` to that message too. Also fix `case 'warning' || 'error':` in `setErrorLevel`, which only matched 'warning'. The result was the same, since 'error' is the default. The result-panel test that documented the old behaviour now asserts the error state for a timeout, a network error and a non-JSON response.
This was referenced Nov 21, 2026
WilhelmZA
reviewed
Nov 21, 2026
WilhelmZA
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed at 8f27e673.
The change is correct: isError now covers a failure with no error body, an AbortError maps to messages.requestTimeout, and the tests replace the one from #505 that documented the bug. CI gate passes and the commit is verified.
Before approval:
- The
AbortErrormapping depends on the #511 fix in #536, which is not merged. Onmain,useLGQuerykeeps one controller per panel andfetchWithTimeoutnever clears its timer. If this PR merges first, a requery more thanrequestTimeoutafter a successful query rejects at once, and the panel shows "Request timed out." although no request was sent. Please merge #536 first, or state in the body that this PR waits for #536. - The body names #511 as the change that edits
hooks/use-lg-query.test.tsx. #511 is the issue; the PRs are #536 and #563. The body also says #534 is still open, and it has merged.
#564 and #565 also change results/individual.tsx.
Nits:
- The body has a Changelog entry but
CHANGELOG.mdis not edited. Please add it under[Unreleased], here or in the release PR.
Collaborator
Author
|
Thanks.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge after #536. The
AbortErrormapping below relies on the #511 fix in #536 (a fresh controller per request, timer cleared on settle). Onmainwithout it, a requery more thanrequestTimeoutafter a successful query would reject at once and show "Request timed out.".Problem
Result(components/results/individual.tsx) decided whether a result was an error from the response body alone:A request that fails without an error body (a timeout, a network error, a response that is not JSON) leaves
dataundefined and sets onlyerror.isErrorwas false, so the panel stayed collapsed and the header showed the success icon and "Completed in 0 seconds". The messageerrorMsgbuilds fromerrorwas never shown.A timeout also showed the wrong text.
fetchWithTimeoutaborts the request, andfetchrejects with anAbortErrorwhose message is "This operation was aborted".errorMsgonly usedmessages.requestTimeoutwhen the message started with "timeout", so a timed-out query would have shown "This Operation Was Aborted".Change
individual.tsx:isErroris also true when the query has anerror. The panel expands with the error alert, and the header shows the error icon with the error message as its tooltip. The cache countdown stays hidden. The same applies when a requery fails after a successful query: the error replaces the old output (the copy button already copied the error text in that case).individual.tsx:errorMsgmaps anAbortErrorto the configuredmessages.requestTimeout. After Requery fails at once after requestTimeout because the abort controller is reused #511 (fixed in fix(ui): give each query request its own abort controller and timeout #536), anAbortErroronly comes from the request timeout or from unmounting, and an unmounted result shows nothing.individual.tsx:case 'warning' || 'error':insetErrorLevelevaluated tocase 'warning':; it is now written that way. No behaviour change, since'error'is the default.individual.test.tsx: the test(ui): cover results, layout and the index page #505 test "leaves a failed request collapsed and unflagged", which documented the bug, is replaced by "expands and flags %s as an error" for a timeout (DOMExceptionAbortError), a network error (TypeError('Failed to fetch')) and a non-JSON response. Each checks the expanded panel, the alert text and level, the error icon and its tooltip, and that the cache countdown is hidden. The separate non-JSON status-text test is folded into it. A new test covers a requery that fails after a success. The success tooltip test also checks the header doesn't show the error icon. Thefailed()helper is gone: failed queries now expand, so the other error tests usesettled().The error icon is identified by comparing the drawing (
path d) of the header icon withreact-icons'BiError.Tests
With
origin/main'sindividual.tsxand the new tests, 9 tests fail. The 5 existing "shows the message for ..." cases fail too, because they now wait for the panel to expand:With only the
AbortErrormapping reverted, 1 test fails:With the fix:
biome format,biome lint,tsc --noEmitandtestpass;Tests 206 passed (206).Changelog
messages.requestTimeout(A failed query with no error body is shown as a successful result #509).Notes
errorMsgalready worked, and it is unchanged here.hooks/use-lg-query.test.tsxhas a comment ("The results view maps an error tomessages.requestTimeoutonly when its message starts with "timeout"...") that this PR makes stale. It is left alone because fix(ui): give each query request its own abort controller and timeout #536 and fix(ui): don't resend a looking-glass query on its own #563 (the Requery fails at once after requestTimeout because the abort controller is reused #511 and Failed looking-glass queries are retried three times, reaching the device four times #546 fixes) edit that file.results/individual.tsx; whichever merges later rebases.Closes #509