Skip to content

refactor(core): route per-instance warnings and Chat's focus park through the shared owners - #10662

Closed
humbertovirtudes wants to merge 2 commits into
table-virt/2-shared-helpersfrom
table-virt/2b-shared-owner-adoption
Closed

humbertovirtudes wants to merge 2 commits into
table-virt/2-shared-helpersfrom
table-virt/2b-shared-owner-adoption

Conversation

@humbertovirtudes

Copy link
Copy Markdown
Contributor

Stack

This PR builds on #10655 and is independent of the Table PRs above it. Merge it after #10655.

Maintainer impact

#10655 makes createDevWarnings the owner of per-instance warning deduplication and focusForLastInputTemporarily the 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 through focusForLastInputTemporarily.

Change

  • Resizable: createResizable creates one createDevWarnings() per instance. resolveBound takes that function (or null to stay quiet) instead of a didWarnRef, and keys each warning by its role (minSize, maxSize, defaultSize, inverted), so each warns once per instance as before.
  • Dialog and TabList: the warn-once refs become useState(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 temporary tabindex from focusForLastInputTemporarily, passing the tracked modality. It keeps its inline outline: none after touch input, because WebKit ignores focusVisible: false, and removes it on blur as before.

Warning text, timing and production silence are unchanged.

Evidence

  • Existing Resizable, Dialog, TabList, Chat keyboard and focus tests pass unchanged, including the parked group's focus-ring test.
  • Strict lint and pnpm typecheck in packages/core pass.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run --project ui over Chat, Dialog, Resizable, TabList, utils and hooks: 3,235 tests pass. One locale time-format test fails on the local machine's ICU data and passes in CI.
  • Format, strict lint (--max-warnings=0) on every changed file, and pnpm typecheck in packages/core pass on this exact head.

This PR was generated with AI assistance (Navi).

…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
@vercel

vercel Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 8, 2026 9:27am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 8, 2026
@astracat-bot

astracat-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 8, 2026, 9:42 AM UTC

…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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts and focusReturn.ts; rebase onto the current base tip and keep only the useState and 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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 748 to 749
// The header-title check reads the DOM, so this stays in an effect; the ref
// keeps it to one warning per component instance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

@humbertovirtudes

Copy link
Copy Markdown
Contributor Author

Superseded: the bot asked for these adoptions to ship with the helpers they adopt, so they are now part of #10655.

@github-actions
github-actions Bot deleted the table-virt/2b-shared-owner-adoption branch November 9, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — c2161bd6 Deployed Nov 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant