Repository navigation
fix(native): show the read verdict in the FileViewerHost body with a Retry button - #2
Merged
Merged
Conversation
…Retry button
After `fetcher.read` returned `{ error }` the host set the top error bar but
`content` stayed `null`, so `loading || html === null` kept the "Fetching …"
spinner drawing under the message and the only way out was close/reopen.
- On a read failure the body now renders the fetcher's verdict (e.g. the
liveness-aware "This session isn't responding — is it online?") with a
Retry button that re-runs `fetcher.read` for the same request; while the
retry is in flight the normal loading state shows again.
- The top error bar is reserved for failures on top of a displayed file
(save, editor bridge), so the same message is never shown twice.
- The `!fetcher` "No active session" branch was unreachable behind the
spinner condition; it is checked first now.
Adds the first component spec in @codeam/ide-native: react-dom into jsdom
with thin DOM stubs for the RN primitives (`src/test/setup.tsx`), driven
through the real `FileViewerProvider`.
Refs: codeagent-rtbh
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.
Problem
packages/native/src/components/FileViewerHost.tsxrendered the body asAfter
fetcher.readreturned{ error }the host seterror(top bar) butcontentstayednull, so the spinner kept spinning under the message and there was no Retry — only close/reopen. The consumer (codeagent-mobile #2822) now returns liveness-aware verdicts as that error string ("This session isn't responding — is it online?"), which made the dead-end visible.Fix
fetcher.readfor the same request (readAttemptcounter in the read effect's deps). While the retry is in flight the normal "Fetching …" state shows again.error && html !== null— so the same message is never shown twice.!fetcher"No active session" branch was unreachable behind the spinner condition; it is checked first now.Styling reuses the file's existing chrome constants (
#a78bfabutton,#fecacaerror text, placeholder layout).Tests
First component spec in
@codeam/ide-native: real render throughreact-dominto jsdom, RN primitives replaced by thin DOM stubs (src/test/setup.tsx,vitest.config.ts); the WebView stub exposes its bridge so the save path is exercised like Cmd+S.npm run test --workspace @codeam/ide-native -- src/components/FileViewerHost.test.tsx→ 4 passed (RED onmain: 3 failed / 1 passed).npm run typecheckandnpm run lintclean.New dev deps:
jsdom(root),react-dom(native devDependencies, matches web).Refs bead
codeagent-rtbh.🤖 Generated with Claude Code