Repository navigation
fix(lint): move the doc preview guest-focus handoff into its own hook - #28110
Merged
Merged
Conversation
5 of 8 tasks
brennanb2025
pushed a commit
that referenced
this pull request
Oct 15, 2026
…#28110) HtmlDocPreview.tsx reached 403 lines on main (#27608 + #27875), over the 400-line limit for .tsx, so lint and the pre-commit hook fail on any branch that merges main. The focus handoff effect moves unchanged into use-doc-preview-guest-focus.ts. Co-authored-by: Orca Worker <orca-worker@localhost> (cherry picked from commit 5e83ca0)
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.
ELI5
Two PRs that each touched the HTML document preview (#27608 and #27875) pushed
HtmlDocPreview.tsxto 403 lines, over the 400-line lint limit for.tsxfiles. Lint fails on that file, and the pre-commit hook rejects any merge commit that brings in current main. This moves one self-contained piece of the component into its own hook.What Changed
use-doc-preview-guest-focus.tsasuseDocPreviewGuestFocus. That covers the frame-by-frame retry, the yield on re-offer, and the re-offer when the window regains focus. ItsGUEST_FOCUS_FRAMESconstant moves with it.HtmlDocPreview.tsxcalls the hook and drops to 357 lines.Why
The focus handoff reads only the webview ref and four values, and nothing else in the component uses its internals, so it splits out cleanly. This avoids a
max-linesdisable, which AGENTS.md forbids.The effect used to depend on
state, and now it takesready: state === 'ready'. It only acted whenstate === 'ready', so moves between the other states never did anything, and it still re-runs whenever the preview becomes ready.Linked Issue
Fixes the
mainlint break from #27608 + #27875 (HtmlDocPreview.tsxat 403 lines, max-lines 400).Visual Proof
N/A: no behaviour change; an effect moves into a hook.
Testing
oxlint (
.oxlintrc.json, anti-slop, code-quality native plugins, design system) with--deny-warningsand oxfmt--checkpass on both files. Before this change,.oxlintrc.jsonfailed withFile has too many lines (403).tsc -p config/tsconfig.tc.web.json: 0 errors.vitest run src/renderer/src/components/browser-pane/workspace-doc: 11 files, 84/84 pass, including the HtmlDocPreview toolbar and page-pane tests that cover focus.I manually tested these changes locally
Automated tests added/updated (behaviour unchanged; existing workspace-doc tests cover it)
Checklist
N/Awith reason