Repository navigation
refactor(core): route per-instance warnings and Chat's focus park through the shared owners - #10662
humbertovirtudes wants to merge 2 commits into
Conversation
…n helpers One devWarning factory now owns per-instance deduplication for the render-safe useDevWarning hook and for callers that cannot use hooks. focusReturn gains the note-and-restore helpers that windowed Table rows use to return focus when a focused row unmounts. This diff was generated with AI assistance (Navi). Tags: ai-generated
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
…ough the shared owners Resizable, Dialog and TabList dedupe their development warnings through createDevWarnings instead of their own flags. Chat's composer park takes its temporary tab stop from focusForLastInputTemporarily; it keeps its inline outline override, because WebKit ignores focusVisible: false. This diff was generated with AI assistance (Navi). Tags: ai-generated
989d87b to
c2161bd
Compare
There was a problem hiding this comment.
Changes requested. The adoption itself looks right: Resizable, Dialog and TabList keep their warning text and once-per-instance behavior through createDevWarnings, and Chat's Done park keeps its focus target and ring behavior through focusForLastInputTemporarily.
To do:
- This branch's first commit is a rewritten copy of the base branch's tip commit (#10655), so the pull request re-adds the whole helper change and conflicts with its base in
useDevWarning.ts,devWarning.tsandfocusReturn.ts; rebase onto the current base tip and keep only theuseStateand doc-comment edits, or push the amended commit to #10655 first and rebase onto it.
Non-blocking: two comments now describe removed flags, at Dialog.tsx lines 748-749 and createResizable.ts line 172.
[Automated review]
| isPerMessage: boolean, | ||
| ): void { | ||
| // State survives Fast Refresh, so a hot update does not repeat a warning. | ||
| const [warn] = useState(createDevWarnings); |
There was a problem hiding this comment.
The base branch already adds this function, with useMemo on this line. This branch re-adds the whole helper commit, which is why it conflicts with its base. After a rebase onto the base tip, this line and the two doc comments should be the only helper edits left.
| // The header-title check reads the DOM, so this stays in an effect; the ref | ||
| // keeps it to one warning per component instance. |
There was a problem hiding this comment.
Non-blocking: the ref this comment names is gone. Suggested: "The header-title check reads the DOM, so this stays in an effect."
| @@ -170,7 +170,7 @@ function readWindowExtent(direction: ResizableDirection): number | null { | |||
| } | |||
|
|
|||
| /** Starts as warned: the factory warns, and this first-render read does not. */ | |||
There was a problem hiding this comment.
Non-blocking: "Starts as warned" described the old {current: true} flag; null now means no warning at all. Suggested: "The factory warns. This first-render read does not."
f0103e8 to
b50c5cb
Compare
b50c5cb to
5cad527
Compare
|
Superseded: the bot asked for these adoptions to ship with the helpers they adopt, so they are now part of #10655. |
Stack
This PR builds on #10655 and is independent of the Table PRs above it. Merge it after #10655.
Maintainer impact
#10655 makes
createDevWarningsthe owner of per-instance warning deduplication andfocusForLastInputTemporarilythe owner of temporary tab stops. Four existing components kept their own copies.Intended invariant
Each concern has one owner in Core: per-instance warnings go through
createDevWarnings, and temporary tab stops go throughfocusForLastInputTemporarily.Change
Resizable:createResizablecreates onecreateDevWarnings()per instance.resolveBoundtakes that function (ornullto stay quiet) instead of adidWarnRef, and keys each warning by its role (minSize,maxSize,defaultSize,inverted), so each warns once per instance as before.DialogandTabList: the warn-once refs becomeuseState(createDevWarnings). TabList keys its content warning so it still warns once per instance even when the offending tag changes.Chat: the composer park takes its temporarytabindexfromfocusForLastInputTemporarily, passing the tracked modality. It keeps its inlineoutline: noneafter touch input, because WebKit ignoresfocusVisible: false, and removes it on blur as before.Warning text, timing and production silence are unchanged.
Evidence
Resizable,Dialog,TabList,Chatkeyboard and focus tests pass unchanged, including the parked group's focus-ring test.pnpm typecheckinpackages/corepass.Scope
Testing
vitest run --project uioverChat,Dialog,Resizable,TabList,utilsandhooks: 3,235 tests pass. One locale time-format test fails on the local machine's ICU data and passes in CI.--max-warnings=0) on every changed file, andpnpm typecheckinpackages/corepass on this exact head.This PR was generated with AI assistance (Navi).