Repository navigation
fix(useTouchTrigger): sync its callback refs at commit - #10892
Conversation
The touch trigger kept its open state, its document listener's values and its tap answer in refs written while it rendered. A render React discards, as a suspended transition does, left its values there. A tap after a discarded render that disabled a hover card then answered with that render's props, and the card did not open. Each ref is now synced in a one-line layout effect, so it holds the committed value when a tap or the document listener reads it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | ✓ · ✓ · ✗ |
| CommandPalette | 76.0 kB (+50 B) · 12.7 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 65.3 kB (+46 B) · 10.4 kB CSS (0) | — | — · — · — |
113 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| CheckboxInput | 68.8 kB (+45 B) · 10.1 kB CSS (0) | — | — · — · — |
| Switch | 108.7 kB (+38 B) · 10.0 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 65.0 kB (+37 B) · 10.5 kB CSS (0) | — | — · — · — |
| Tooltip · Storybook | 32.0 kB (+37 B) · 4.5 kB CSS (0) | 878 (+8) | ✓ · ✓ · ✓ |
| BreadcrumbItem | 91.1 kB (+36 B) · 12.5 kB CSS (0) | — | — · — · — |
| Calendar | 75.5 kB (+36 B) · 11.0 kB CSS (0) | — | — · — · — |
| ChatSendButton | 64.9 kB (+35 B) · 10.3 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 34.8 kB (+34 B) · 8.4 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 88.0 kB (+34 B) · 372 B CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 68.6 kB (+34 B) · 162 B CSS (0) | — | — · — · — |
| ChatDictationButton | 65.0 kB (+33 B) · 10.4 kB CSS (0) | — | — · — · — |
| DialogHeader | 67.3 kB (+32 B) · 11.9 kB CSS (0) | — | — · — · — |
| DrawerHeader | 67.5 kB (+32 B) · 13.3 kB CSS (0) | — | — · — · — |
| MobileNav | 75.0 kB (+31 B) · 11.0 kB CSS (0) | — | — · — · — |
| Button | 64.5 kB (+28 B) · 10.3 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 34.3 kB (+28 B) · 7.6 kB CSS (0) | — | — · — · — |
| Text | 14.2 kB (+28 B) · 5.5 kB CSS (0) | — | — · — · — |
| AlertDialog | 110.6 kB (+27 B) · 15.0 kB CSS (0) | — | — · — · — |
| Link | 56.2 kB (+27 B) · 7.1 kB CSS (0) | — | — · — · — |
| PowerSearch | 303.7 kB (+27 B) · 24.7 kB CSS (0) | — | — · — · — |
| AppShell | 96.3 kB (+26 B) · 13.8 kB CSS (0) | — | — · — · — |
| ChatMessageList | 30.6 kB (+26 B) · 7.1 kB CSS (0) | — | — · — · — |
| Slider | 114.3 kB (+26 B) · 8.9 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 74.7 kB (+26 B) · 13.6 kB CSS (0) | — | — · — · — |
| Toast | 102.7 kB (+26 B) · 10.6 kB CSS (0) | — | — · — · — |
| CodeBlock | 79.7 kB (+25 B) · 11.6 kB CSS (0) | — | — · — · — |
| Heading | 14.8 kB (+25 B) · 5.5 kB CSS (0) | — | — · — · — |
| lab/ListInput | 92.9 kB (+24 B) · 922 B CSS (0) | — | — · — · — |
| BaseTypeahead | 77.7 kB (+23 B) · 11.3 kB CSS (0) | — | — · — · — |
| Banner | 66.5 kB (+22 B) · 10.9 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 64.8 kB (+22 B) · 10.3 kB CSS (0) | — | — · — · — |
| Timer | 16.4 kB (+22 B) · 6.1 kB CSS (0) | — | — · — · — |
| TopNav | 76.7 kB (+22 B) · 11.3 kB CSS (0) | — | — · — · — |
| lab/Comments | 367.4 kB (+22 B) · 2.5 kB CSS (0) | — | — · — · — |
| Thumbnail | 68.8 kB (+21 B) · 11.9 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 92.4 kB (+21 B) · 2.1 kB CSS (0) | — | — · — · — |
| charts/ChartTooltip | 188.6 kB (+20 B) · 451 B CSS (0) | — | — · — · — |
| lab/CommentThread | 360.3 kB (+18 B) · 2.4 kB CSS (0) | — | — · — · — |
| IconButton | 64.5 kB (+17 B) · 10.3 kB CSS (0) | — | — · — · — |
| Stepper | 66.2 kB (+17 B) · 10.5 kB CSS (0) | — | — · — · — |
| TimeInput | 169.4 kB (+17 B) · 16.4 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 91.8 kB (+17 B) · 751 B CSS (0) | — | — · — · — |
| SideNavItem | 76.3 kB (+16 B) · 11.5 kB CSS (0) | — | — · — · — |
| TextInput | 72.2 kB (+15 B) · 11.5 kB CSS (0) | — | — · — · — |
| Avatar | 45.8 kB (+14 B) · 5.7 kB CSS (0) | — | — · — · — |
| ListItem | 74.8 kB (+14 B) · 11.7 kB CSS (0) | — | — · — · — |
| Timestamp | 35.8 kB (+14 B) · 10.6 kB CSS (0) | — | — · — · — |
| AvatarGroup | 48.6 kB (+13 B) · 5.8 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 75.5 kB (+13 B) · 12.2 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 303.8 kB (+13 B) · 2.6 kB CSS (0) | — | — · — · — |
| CheckboxList | 72.9 kB (+12 B) · 7.8 kB CSS (0) | — | — · — · — |
| Popover | 96.8 kB (+12 B) · 14.6 kB CSS (0) | — | — · — · — |
| StatusDot | 33.7 kB (+12 B) · 5.4 kB CSS (0) | — | — · — · — |
| lab/LineClamp | 16.4 kB (+12 B) · 168 B CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 97.4 kB (+12 B) · 1.8 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 281.5 kB (+12 B) · 2.3 kB CSS (0) | — | — · — · — |
| SideNavHeading | 81.9 kB (+11 B) · 11.7 kB CSS (0) | — | — · — · — |
| Spinner | 27.2 kB (+11 B) · 6.3 kB CSS (0) | — | — · — · — |
| Typeahead | 87.0 kB (+11 B) · 12.8 kB CSS (0) | — | — · — · — |
| lab/TransferList | 107.1 kB (+10 B) · 1.2 kB CSS (0) | — | — · — · — |
| charts/Chart | 211.5 kB (+9 B) · 516 B CSS (0) | — | — · — · — |
| DateInput | 196.2 kB (+9 B) · 17.4 kB CSS (0) | — | — · — · — |
| charts/ChartLegend | 54.8 kB (+8 B) · 224 B CSS (0) | — | — · — · — |
| Tokenizer | 103.1 kB (+8 B) · 19.5 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 75.6 kB (+7 B) · 11.7 kB CSS (0) | — | — · — · — |
| FileInput | 73.5 kB (+7 B) · 11.3 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 158.2 kB (+7 B) · 1.9 kB CSS (0) | — | — · — · — |
| RadioListItem | 71.9 kB (+6 B) · 10.4 kB CSS (0) | — | — · — · — |
| TabMenu | 78.1 kB (+4 B) · 11.5 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 115.9 kB (+4 B) · 1.4 kB CSS (0) | — | — · — · — |
| Carousel | 74.1 kB (+3 B) · 11.3 kB CSS (0) | — | — · — · — |
| Lightbox | 145.3 kB (+3 B) · 11.5 kB CSS (0) | — | — · — · — |
| RadioList | 60.6 kB (+3 B) · 7.3 kB CSS (0) | — | — · — · — |
| MultiSelector | 100.7 kB (+2 B) · 17.2 kB CSS (0) | — | — · — · — |
| TopNavHeading | 81.5 kB (+2 B) · 11.6 kB CSS (0) | — | — · — · — |
| ChatLayout | 87.7 kB (+1 B) · 10.9 kB CSS (0) | — | — · — · — |
| Markdown | 195.4 kB (+1 B) · 21.1 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 112.1 kB (+1 B) · 773 B CSS (0) | — | — · — · — |
| ToggleButton | 91.4 kB (0) · 10.4 kB CSS (0) | — | — · — · — |
| ProgressBar | 11.9 kB (−1 B) · 6.4 kB CSS (0) | — | — · — · — |
| SideNav | 119.7 kB (−1 B) · 11.7 kB CSS (0) | — | — · — · — |
| Table | 132.4 kB (−1 B) · 18.7 kB CSS (0) | — | — · — · — |
| ComplexSelector | 76.9 kB (−2 B) · 12.2 kB CSS (0) | — | — · — · — |
| DateTimeInput | 218.6 kB (−2 B) · 19.1 kB CSS (0) | — | — · — · — |
| lab/TourStep | 92.4 kB (−2 B) · 691 B CSS (0) | — | — · — · — |
| Field | 59.3 kB (−3 B) · 7.3 kB CSS (0) | — | — · — · — |
| ContextMenu | 114.3 kB (−5 B) · 17.8 kB CSS (0) | — | — · — · — |
| TopNavMenu | 80.8 kB (−5 B) · 11.6 kB CSS (0) | — | — · — · — |
| ChatComposer | 83.9 kB (−8 B) · 12.4 kB CSS (0) | — | — · — · — |
| DateRangeInput | 98.6 kB (−8 B) · 12.9 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 115.1 kB (−8 B) · 18.0 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 286.2 kB (−8 B) · 454 B CSS (0) | — | — · — · — |
| InputGroup | 60.9 kB (−9 B) · 7.9 kB CSS (0) | — | — · — · — |
| Pagination | 117.7 kB (−9 B) · 18.2 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 113.3 kB (−10 B) · 1.1 kB CSS (0) | — | — · — · — |
| HoverCard · Storybook | 30.1 kB (−11 B) · 4.5 kB CSS (0) | 836 (0) | ✓ · ✓ · — |
| TableCell | 115.6 kB (−11 B) · 18.3 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 51.7 kB (−12 B) · 5.7 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 81.6 kB (−13 B) · 11.7 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 81.6 kB (−13 B) · 11.7 kB CSS (0) | — | — · — · — |
| NumberInput | 76.9 kB (−13 B) · 11.8 kB CSS (0) | — | — · — · — |
| Selector | 106.6 kB (−14 B) · 17.9 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 60.2 kB (−21 B) · 1.2 kB CSS (0) | — | — · — · — |
| DropdownMenu | 103.6 kB (−24 B) · 17.9 kB CSS (0) | — | — · — · — |
| TextArea | 66.6 kB (−24 B) · 9.4 kB CSS (0) | — | — · — · — |
| InfoTip | 50.2 kB (−26 B) · 5.4 kB CSS (0) | — | — · — · — |
| FieldLabel | 55.2 kB (−31 B) · 5.8 kB CSS (0) | — | — · — · — |
| lab/Schedule | 111.3 kB (−32 B) · 3.9 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 74.3 kB (−34 B) · 10.1 kB CSS (0) | — | — · — · — |
| MoreMenu | 103.8 kB (−40 B) · 17.9 kB CSS (0) | — | — · — · — |
| SegmentedControl | 101.8 kB (−45 B) · 6.9 kB CSS (0) | — | — · — · — |
| layer | — | — | — · ✓ · — |
| Layer | — | — | ✓ · ✓ · — |
Package size: @astryxdesign/core 7.49 MB packed (+246 B); no new dependencies.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 4bf8c32 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because the pull request is a draft; marking it ready for review starts it.
The five touch-trigger refs now follow the committed props, and the four new tests fail against main's hook and pass here, each one tied to its own ref.
Optional, non-blocking:
- The comment above
respondToTap(useTouchTrigger.ts:553-554) still says the tap reads "the latest props through this ref"; it now reads the committed props throughanswerTapRef. - The header of
useTouchTrigger.test.tsstill lists only the pure helpers in@inputand@output; adduseTouchTriggerand the discarded-render cases. - The description quotes
architecture:react-component-runtimeINV3 as allowing "a one-line layout effect"; INV3 does not say that, though the change meets its actual text (synchronization that acquires no resource stays idempotent and safe under StrictMode replay).
[Automated review]
There was a problem hiding this comment.
Changes requested: one changeset sentence claims more than the fix delivers; the code change itself checks out.
- Miss: the changeset says a tap after a discarded render "now answers with the committed props", but a Tooltip whose discarded render sets
isOpen(committed render uncontrolled) still ignores the tap, becauseuseTooltipsends the trigger'spointerdownthroughhandlersRef, which it assigns during render (useTooltip.tsx:703); narrow the sentence to what the fix covers (isEnabled,touchTrigger, the open state and the outside dismissal), or also assignhandlersRefat commit.
The four new tests fail against the base hook and pass here, and each tested ref fails its own test when written during render again. The two earlier non-blocking comments (the comment above respondToTap and the test file header) still apply. CI has not run on this head because the pull request is a draft.
The touch trigger copied its open state, hide, layer id, release callback and tap answer into refs in five layout effects. The shared internal hook makes the same writes at commit, earlier, so the trigger calls it. The callbacks that read the refs list them in their dependencies.
|
/approve-spec d33c531 |
There was a problem hiding this comment.
Changes requested: two text fixes; the code change itself reads correctly.
- Miss: the changeset says a tap after a discarded render "now answers with the committed props", but a Tooltip whose discarded render sets
isOpen(committed render uncontrolled) still ignores the tap, becauseuseTooltipsends the trigger'spointerdownthroughhandlersRef, which it writes during render (useTooltip.tsx:703); narrow the sentence to what the fix covers (isEnabled,touchTrigger, the open state and the outside dismissal), or also movehandlersRefontouseCommittedRef. - The description's Testing section calls #10639 open, but it merged on 2026-11-10 and is already part of this branch's base; drop or correct that line.
Moving the five refs onto useCommittedRef follows the shared latest-value-ref hook. The four earlier non-blocking inline comments (the redundant isOpenRef, the comment that restates answerTapRef, the stale comment above respondToTap, and the test file header) still apply. CI has not run on this head because the pull request is a draft.
Claims and files checked
- Changeset, a patch release of core: verified; only core source changes and no public API changes.
- Changeset, the touch trigger syncs its refs at commit: verified (
useTouchTrigger.ts:440-446,:585). - Changeset, a tap after a discarded render now answers with the committed props: false for a Tooltip whose discarded render sets
isOpen(useTooltip.tsx:703,:749). - Description, the five named refs were written during render, are each read in a callback, and no longer are written there: verified (
useTouchTrigger.ts:436-446,:504-517,:575,:584-585,:599-601). - Description, each ref comes from the shared commit-time hook, and the tap's answer is a plain function whose ref comes from it too: verified (
useTouchTrigger.ts:440-446,:552,:585;hooks/useCommittedRef.ts:33-38). - Description, the callbacks that read the refs list them in their dependencies: verified (
useTouchTrigger.ts:526-532,:604,:622). - Description, who is affected and how (a tap after a discarded render that disabled a hover card did not open it): verified from the code and the HoverCard test.
- Description, the cited authority (React's rule against writing refs during render; the runtime rules for latest-value refs, pure render and ref-backed state): verified against the current records.
- Description, a merged Lab pull request (#10780) made the same kind of change: verified (merged on 2026-11-09).
- Description, five refs and no API, visual or default change: verified from the source.
- Description, the release-in-layer ref needs no test because its only caller passes a stable callback: verified (
useTooltip.tsx:375-380). - Description, what each new test sets up and which ref it covers: verified by reading the tests against the base and head hook.
- Description, the four new tests fail on main and pass here, each fails while its ref is written during render, and the wider suites, typecheck, ESLint and Prettier pass: not re-checked at this head.
- Description, #10639 is open and merges clean with this change: false; it merged on 2026-11-10 and is in the base (it does touch this file, and both merges of main are clean).
- Description, both merges of main had no conflicts, the first left the change's own diff unchanged, the second brought the shared hook, and the last commit moves the refs onto it: verified from the history.
.changeset/touch-trigger-refs-at-commit.md: finding (the Tooltip claim above).packages/core/src/Layer/useTouchTrigger.ts: non-blocking comment notes only; otherwise clear.packages/core/src/Layer/useTouchTrigger.test.ts: non-blocking (file header).packages/core/src/HoverCard/HoverCard.test.tsx: clear.
Tooltip's handlers and controlled state were refs written during render. A discarded render that set isOpen made a tap look controlled, and kept a shown tooltip open on a press outside. Both refs now come from useCommittedRef, and two new tests cover those cases. isEnabledRef stays as it is: the trigger's ref cleanup reads it in the commit that disables the tooltip, before any insertion effect runs. The touch trigger drops isOpenRef: only the committed respondToTap runs, and it reads isOpen. Two comments and the test file header now match the code.
|
Answers to the review of d33c531, at e3428b6: Tooltip's handler and controlled-state refs move to |
|
/approve-spec e3428b6 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is a draft; marking it ready for review starts it.
Moving the touch trigger's refs, and Tooltip's handler and controlled-state refs, onto useCommittedRef restores Tooltip and HoverCard taps and the pinned tooltip's press-outside close after a discarded render, and both earlier change requests are addressed. One non-blocking point is inline: the trigger's ref cleanup now reads the previous commit's isOpen beside the disabling render's isEnabled (useTooltip.tsx:825); no caller hits the case today, but a detach test would pin the intended value.
Claims and files checked
- Changeset, a patch release of core: verified; only core source changes and no public API changes.
- Changeset, the touch trigger and Tooltip's handlers and controlled state sync at commit: verified (
useTouchTrigger.ts:440-442,:580;useTooltip.tsx:358,:687). - Changeset, after a discarded render a tap answers with the committed props: verified (
useTooltip.tsx:735calls the committed handlers;useTouchTrigger.ts:594-596; the Tooltip and HoverCard tests). - Changeset, a press outside still closes a shown tooltip: verified (
useTooltip.tsx:384-394reads the committed controlled state; the show/hide test). - Description, the seven named refs were written during render and each is read in a callback: verified (
useTouchTrigger.ts:500,:504,:513,:594-596;useTooltip.tsx:387,:419,:426,:580,:727,:990). - Description, who is affected and how (a discarded disabling render left a hover card shut on a tap; a discarded controlling render made a Tooltip ignore a tap and kept a pinned tooltip open after a press outside): verified by tracing the base code.
- Description, each ref now comes from the shared commit-time hook, the tap's answer is a plain function, and the open-state ref is gone: verified (
useTouchTrigger.ts:548-580;hooks/useCommittedRef.ts:21-38). - Description, the enabled-state ref stays because the trigger's ref cleanup reads it before the commit's insertion effects: verified (
useTooltip.tsx:323-324,:825). - Description, the callbacks that read the refs list them as dependencies: verified (
useTouchTrigger.ts:522-528,:599,:617;useTooltip.tsx:394,:421,:432,:594,:834,:1002). - Description, the cited authority (React's rule against render-time ref writes; the runtime rules for latest-value refs, pure render and ref-backed state): verified against the current records.
- Description, five refs in the touch trigger and two in Tooltip, with no API, visual or default change: verified from the source.
- Description, the release-in-layer ref needs no test because its only caller passes a stable callback: verified (
useTooltip.tsx:375-380,:415). - Description, what each new test sets up and which ref it covers: verified by reading each test against the base and head code.
- Description, the six new tests fail on main, one per ref except the release-in-layer ref, and each fails while its ref is written during render: verified by tracing each test through the base code; not executed.
- Description, the wider test run, typecheck, ESLint and Prettier pass: not checked here; CI checks them once the pull request leaves draft.
- Description, the scope checklist (one defect restored, no tagalong, no new public API, visual, default or interaction model, no internal context in public text): verified from the diff and a scan of the added lines, title, body, branch and commit messages.
- Description, the existing Tooltip, HoverCard and Popover tap and outside-tap tests still pass: not checked here; CI runs them once the pull request leaves draft.
- Description, both merges of main were clean, the first left the change's diff unchanged, the second brought the shared hook, and the next commit moved the refs onto it: verified from the history.
.changeset/touch-trigger-refs-at-commit.md: clear.packages/core/src/Layer/useTouchTrigger.ts: clear.packages/core/src/Tooltip/useTooltip.tsx: non-blocking note (trigger cleanup timing).packages/core/src/Layer/useTouchTrigger.test.ts: clear.packages/core/src/HoverCard/HoverCard.test.tsx: clear.packages/core/src/Tooltip/Tooltip.test.tsx: clear.packages/core/src/Tooltip/useTooltip.showHide.test.tsx: clear.
|
/approve-spec a6e45c0 |
There was a problem hiding this comment.
Changes requested: two one-line fixes remain. The discarded-render fix itself reads correctly against base and head.
- The new layout Effect in
useTooltip.tsx(lines 729-734) hides the tooltip's popover and callsonHide, but its note names no external system, whicharchitecture:react-component-runtimeINV3 requires of a new Effect, so open the note with the system it synchronizes (for example "Synchronizes the tooltip's popover with a trigger that detached in this commit."). - The changeset says Tooltip's "controlled and enabled state" syncs at commit, but a pending hover show still checks
disabledRendersRef, which a discarded render that disables the tooltip increments during render (useTooltip.tsx:325-328), so reword it to "Tooltip's handlers with the controlled and enabled flags they carry".
Non-blocking: the comment at useTooltip.tsx:354 restates the useCommittedRef call below it. CI has not run on this head because the pull request is a draft.
Claims and files checked
- Changeset, a patch release of core: verified; only core source changes and no public API changes.
- Changeset, the touch trigger and Tooltip's handlers and controlled state sync at commit: verified (
useTouchTrigger.ts:457-459,:609;useTooltip.tsx:355,:685). - Changeset, Tooltip's enabled state syncs at commit: false for the pending hover show (
useTooltip.tsx:325-328,:483-489); true for the trigger's attach and detach. - Changeset, after a discarded render a tap answers with the committed props: verified for Tooltip and HoverCard (
Tooltip.test.tsx:462,HoverCard.test.tsx:1686). - Changeset, a press outside still closes a shown tooltip: verified (
useTooltip.tsx:381-391;useTooltip.showHide.test.tsx:206). - Description, the eight named refs were written during render and each is read in a callback: verified with the repository's render-write scan on both trees.
- Description, who is affected and how after a discarded render: verified by tracing the base code.
- Description, each ref now comes from the shared commit-time hook, the tap answer is a plain function and the open-state ref is gone: verified (
useTouchTrigger.ts:563-609). - Description, the detach marks itself pending and settles from committed flags in a layout Effect or a microtask: verified (
useTooltip.tsx:711-734,:844-847). - Description, the callbacks that read the refs list them as dependencies: verified.
- Description, the cited rules on render-time ref writes and committed refs: verified as cited.
- Description, five refs in the touch trigger and three in Tooltip, with no API, visual or default change: verified.
- Description, the release-in-layer ref needs no test because only Tooltip passes it, as a stable callback: verified (
useTooltip.tsx:372-377,:412). - Description, what each new test sets up and which ref it covers: verified by reading each test against the base and head code.
- Description, the seven tests fail on main and pass at this head, and the two detach cases fail on the stated earlier revisions: traced through the code, not executed.
- Description, the guard that unmounts a disabled tooltip logs no error: the test checks it (
useTooltip.test.tsx:317); not executed. - Description, the full test run, typecheck, ESLint, Prettier and browser specs pass: not checked; CI runs once the pull request leaves draft.
- Description, browser specs and a frame probe at a later revision: not checkable; that commit is not in the pushed history.
- Description, the merges of main were clean and kept the other pull request's tests with one shared
actimport: verified from the history and imports. - Description, the last commit settles the detach on committed flags and leaves no render-time write in the change: verified (the render-write scan at the head lists only the untouched
disabledRendersRef). - Description, the scope checklist (one defect, no tagalong, no new API, no internal context): verified.
.changeset/touch-trigger-refs-at-commit.md: the wording finding above.packages/core/src/Tooltip/useTooltip.tsx: the Effect-note finding above and a non-blocking comment note.packages/core/src/Layer/useTouchTrigger.ts: clear.packages/core/src/Layer/useTouchTrigger.test.ts: clear.packages/core/src/HoverCard/HoverCard.test.tsx: clear.packages/core/src/Tooltip/Tooltip.test.tsx: clear.packages/core/src/Tooltip/useTooltip.showHide.test.tsx: clear.packages/core/src/Tooltip/useTooltip.test.tsx: clear.
The layout Effect that settles a detach names the popover it synchronizes. The changeset names the flags the handlers carry, and a comment that restated a call goes.
|
/approve-spec 04d9c2f |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is a draft; marking it ready for review runs it, since it already carries the ci:run label.
The three notes from the previous review are addressed: the layout Effect's note names the popover it synchronizes, the changeset names the flags Tooltip's handlers carry, and the comment that restated the useCommittedRef call is gone. Every change restores current Tooltip and HoverCard behavior under architecture:react-component-runtime INV3 and INV17, with no public API change.
Claims and files checked
- Changeset, a patch release of core: verified; only core source changes, with no public API change.
- Changeset, the touch trigger and Tooltip's handlers, with the controlled and enabled flags they carry, sync at commit: verified (
useTouchTrigger.ts:457-459,:609;useTooltip.tsx:354,:684-701). - Changeset, after a discarded render a tap answers with the committed props: verified for Tooltip and HoverCard (
Tooltip.test.tsx:462,HoverCard.test.tsx:1686). - Changeset, a press outside still closes a shown tooltip: verified (
useTooltip.tsx:380-390;useTooltip.showHide.test.tsx:206). - Description, the eight named refs were written during render and each is read in a callback: verified with the repository's render-write scan on both trees.
- Description, who is affected and how after a discarded render: verified by tracing the base code.
- Description, each ref now comes from the shared commit-time hook, the tap answer is a plain function and the open-state ref is gone: verified (
useTouchTrigger.ts:563-609). - Description, the detach marks itself pending and settles from committed flags in a layout Effect or a microtask: verified (
useTooltip.tsx:711-733,:843-846). - Description, the callbacks that read the refs list them as dependencies: verified.
- Description, the cited rules on render-time ref writes, committed refs and ref-fed rendering: verified as cited.
- Description, five refs in the touch trigger and three in Tooltip, with no API, visual or default change: verified.
- Description, the release-in-layer ref needs no test because only Tooltip passes it, as a stable callback: verified (
useTooltip.tsx:371-376,:411). - Description, what each new test sets up and which ref it covers: verified by reading each test against the base and head code.
- Description, the seven tests fail on main and pass at the earlier revision this head keeps, and the two detach cases fail on the stated earlier revisions: traced through the code, not executed.
- Description, this head changes only two comments and the changeset: verified.
- Description, the guard that unmounts a disabled tooltip logs no error: the test checks it (
useTooltip.test.tsx:317); not executed. - Description, the full test run, typecheck, ESLint, Prettier and browser specs pass: not checked; CI runs once the pull request leaves draft.
- Description, browser specs and a frame probe at a revision outside the pushed history: not checkable.
- Description, the merges of main were clean and kept the other pull request's tests with one shared
actimport: verified from the history and imports. - Description, the history of the later commits (main's detach result kept, a changeset-only wording commit, the committed-flag settle, the Effect note and changeset wording): verified from each commit.
- Description, the scope checklist (one defect, no tagalong, no new API, no internal context): verified.
.changeset/touch-trigger-refs-at-commit.md: clear.packages/core/src/Tooltip/useTooltip.tsx: clear.packages/core/src/Layer/useTouchTrigger.ts: clear.packages/core/src/Layer/useTouchTrigger.test.ts: clear.packages/core/src/HoverCard/HoverCard.test.tsx: clear.packages/core/src/Tooltip/Tooltip.test.tsx: clear.packages/core/src/Tooltip/useTooltip.showHide.test.tsx: clear.packages/core/src/Tooltip/useTooltip.test.tsx: clear.
|
/approve-spec 7a3357c |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is a draft; marking it ready for review runs it, since it already carries the ci:run label.
This head only merges main into the previously reviewed revision, with no conflicts and no change to any of the eight files. Every change still restores current Tooltip and HoverCard behavior under architecture:react-component-runtime INV3 and INV17, with no public API change.
Claims and files checked
- Changeset, a patch release of core: verified; only core source changes, with no public API change.
- Changeset, the touch trigger and Tooltip's handlers, with the controlled and enabled flags they carry, sync at commit: verified (
useTouchTrigger.ts:457-459,:609;useTooltip.tsx:354,:684-701). - Changeset, after a discarded render a tap answers with the committed props: verified for Tooltip and HoverCard (
Tooltip.test.tsx:462,HoverCard.test.tsx:1686). - Changeset, a press outside still closes a shown tooltip: verified (
useTooltip.tsx:380-390;useTooltip.showHide.test.tsx:206). - Description, the eight named refs were written during render and each is read in a callback: verified with the repository's render-write scan on both trees.
- Description, who is affected and how after a discarded render: verified by tracing the base code.
- Description, seven new tests fail on the base, one per ref except the release-in-layer ref: traced through the code, not executed.
- Description, each ref now comes from the shared commit-time hook, the tap answer is a plain function and the open-state ref is gone: verified (
useTouchTrigger.ts:563-609). - Description, Tooltip's handlers, controlled state and enabled flag come from the hook too: verified (
useTooltip.tsx:354,:684-701). - Description, the detach marks itself pending and settles from committed flags in a layout Effect or a microtask: verified (
useTooltip.tsx:710-733,:843-846). - Description, the callbacks that read the refs list them as dependencies: verified.
- Description, the cited rules on render-time ref writes, committed refs and ref-fed rendering: verified as cited.
- Description, five refs in the touch trigger and three in Tooltip, with no API, visual or default change: verified.
- Description, the release-in-layer ref needs no test because only Tooltip passes it, as a stable callback: verified (
useTooltip.tsx:371-376,:411). - Description, what each new test sets up and which ref it covers: verified by reading each test against the base and head code.
- Description, the rail-like swap case passes on the base and fails on the stated earlier revision, and the enabled-flag case covers the microtask path: traced through the code, not executed.
- Description, the guard that unmounts a disabled tooltip logs no error: the test checks it (
useTooltip.test.tsx:317); not executed. - Description, the full test run, typecheck, ESLint, Prettier, browser specs and frame probe pass: not checked; CI runs once the pull request leaves draft.
- Description, the earlier merges of main were clean and kept the other pull request's tests with one shared
actimport: verified from the history and imports. - Description, the latest merge of main has no conflicts, Tooltip's hook reaches three of main's changes (the layer animations it imports, the entrance side and the click guard), and the change's own diff is unchanged: verified from the import chain and by comparing the two diffs.
- Description, the history of the later commits (main's detach result kept, the changeset wording, the committed-flag settle, the Effect note): verified from each commit.
- Description, the scope checklist (one defect, no tagalong, no new API, no internal context): verified.
.changeset/touch-trigger-refs-at-commit.md: clear.packages/core/src/Tooltip/useTooltip.tsx: clear.packages/core/src/Layer/useTouchTrigger.ts: clear.packages/core/src/Layer/useTouchTrigger.test.ts: clear.packages/core/src/HoverCard/HoverCard.test.tsx: clear.packages/core/src/Tooltip/Tooltip.test.tsx: clear.packages/core/src/Tooltip/useTooltip.showHide.test.tsx: clear.packages/core/src/Tooltip/useTooltip.test.tsx: clear.
|
/approve-spec 0146d2b |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is a draft; marking it ready for review runs it, since it already carries the ci:run label.
This head only merges main into the previously reviewed revision, with no conflicts and no change to any of the eight files. Every change still restores current Tooltip and HoverCard behavior under architecture:react-component-runtime INV3 and INV17, with no public API change. The seven new tests fail on main and pass here, and a finger tap after a suspended transition now opens both the hover card and the tooltip in Chromium.
Claims and files checked
- Changeset, a patch release of core: verified; only core source changes, and the repository's API report shows no public API change.
- Changeset, the touch trigger and Tooltip's handlers, with the controlled and enabled flags they carry, sync at commit: verified (
useTouchTrigger.ts:457-459,:609;useTooltip.tsx:354,:684-701). - Changeset, after a discarded render a tap answers with the committed props: verified for Tooltip and HoverCard (
Tooltip.test.tsx:462,HoverCard.test.tsx:1686) and with a real tap in Chromium. - Changeset, a press outside still closes a shown tooltip: verified (
useTooltip.tsx:380-390;useTooltip.showHide.test.tsx:206). - Description, the eight named refs were written during render and each is read in a callback: verified with the repository's render-write scan on both trees.
- Description, who is affected and how after a discarded render: verified by the new tests and the Chromium tap.
- Description, seven new tests fail on the base, one per ref except the release-in-layer ref: verified; run whole, 7 fail and 235 pass on the base, and all 242 pass here.
- Description, each ref now comes from the shared commit-time hook, the tap answer is a plain function and the open-state ref is gone: verified (
useTouchTrigger.ts:563-609). - Description, Tooltip's handlers, controlled state and enabled flag come from the hook too: verified (
useTooltip.tsx:354,:684-701). - Description, the detach marks itself pending and settles from committed flags in a layout Effect or a microtask: verified (
useTooltip.tsx:710-733,:843-846). - Description, the callbacks that read the refs list them as dependencies: verified.
- Description, the cited rules on render-time ref writes, committed refs and ref-fed rendering: verified as cited.
- Description, five refs in the touch trigger and three in Tooltip, with no API, visual or default change: verified.
- Description, the release-in-layer ref needs no test because only Tooltip passes it, as a stable callback: verified (
useTooltip.tsx:371-376,:411). - Description, the existing tap and outside-tap tests for Tooltip, HoverCard and Popover still pass: verified by running those suites.
- Description, what each new test sets up and which ref it covers: verified by reading each test against the base and head code.
- Description, the rail-like swap case passes on the base and fails at its stated earlier revision, and the enabled-flag case fails on the base and at its stated earlier revision: verified by running both.
- Description, the guard that unmounts a disabled tooltip logs no error: verified (
useTooltip.test.tsx:317passes). - Description, the core typecheck, ESLint and Prettier on the changed files are clean: verified.
- Description, the full ui test run, the browser specs and the frame probe pass: not checked; CI runs once the pull request leaves draft.
- Description, the earlier merges of main were clean and kept the other pull request's tests with one shared
actimport: verified from the history and imports. - Description, the latest merge of main has no conflicts, Tooltip's hook reaches five of main's changes (the theme-props helper it imports, the entrance side, the shared resize observer, the theme rule generator and the token references) and the touch trigger four of them, and the change's own diff is unchanged: verified from the import chain and by comparing the two diffs.
- Description, the history of the later commits (main's detach result kept, the changeset wording, the committed-flag settle, the Effect note): verified from each commit.
- Description, the scope checklist (one defect, no tagalong, no new API, no internal context): verified.
.changeset/touch-trigger-refs-at-commit.md: clear.packages/core/src/Tooltip/useTooltip.tsx: clear.packages/core/src/Layer/useTouchTrigger.ts: clear.packages/core/src/Layer/useTouchTrigger.test.ts: clear.packages/core/src/HoverCard/HoverCard.test.tsx: clear.packages/core/src/Tooltip/Tooltip.test.tsx: clear.packages/core/src/Tooltip/useTooltip.showHide.test.tsx: clear.packages/core/src/Tooltip/useTooltip.test.tsx: clear.
|
/approve-spec 0b11850 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because the pull request is a draft; marking it ready for review runs it, since it already carries the ci:run label.
This head only merges main into the previously reviewed revision, with no conflicts and no change to any of the eight files or to the pull request's own patch. Every change still restores current Tooltip and HoverCard behavior under architecture:react-component-runtime INV3 and INV17, with no public API change. The seven new tests still fail on the new main and pass here.
Claims and files checked
- Changeset, a patch release of core: verified; only core source changes, and no public API changes.
- Changeset, the touch trigger and Tooltip's handlers, with the controlled and enabled flags they carry, sync at commit: verified (
useTouchTrigger.ts:457-459,:609;useTooltip.tsx:354,:684-701). - Changeset, after a discarded render a tap answers with the committed props: verified for Tooltip and HoverCard (
Tooltip.test.tsx:462,HoverCard.test.tsx:1686). - Changeset, a press outside still closes a shown tooltip: verified (
useTooltip.tsx:380-390;useTooltip.showHide.test.tsx:206). - Description, the eight named refs were written during render and each is read in a callback: verified on both trees.
- Description, who is affected and how after a discarded render: verified by the new tests.
- Description, seven new tests fail on the base, one per ref except the release-in-layer ref, and pass at this head: verified; run whole, 7 fail and 235 pass on the base, and all 242 pass here.
- Description, each ref now comes from the shared commit-time hook, the tap answer is a plain function and the open-state ref is gone: verified (
useTouchTrigger.ts:563-609). - Description, Tooltip's handlers, controlled state and enabled flag come from the hook too: verified (
useTooltip.tsx:354,:684-701). - Description, the detach marks itself pending and settles from committed flags in a layout Effect or a microtask: verified (
useTooltip.tsx:710-733,:843-846). - Description, the callbacks that read the refs list them as dependencies: verified.
- Description, the cited rules on render-time ref writes, committed refs and ref-fed rendering: verified as cited.
- Description, five refs in the touch trigger and three in Tooltip, with no API, visual or default change: verified.
- Description, the release-in-layer ref needs no test because only Tooltip passes it, as a stable callback: verified (
useTooltip.tsx:371-376,:411). - Description, the existing tap and outside-tap tests for Tooltip and HoverCard still pass: verified by running those files whole.
- Description, what each new test sets up and which ref it covers: verified by reading each test against the base and head code.
- Description, the rail-like swap case passes on the base and fails at its stated earlier revision, and the enabled-flag case fails on the base and at its stated earlier revision: verified (
useTooltip.test.tsx:220,:241). - Description, the guard that unmounts a disabled tooltip logs no error: verified (
useTooltip.test.tsx:317passes). - Description, the core typecheck, ESLint and Prettier on the changed files are clean: verified on the identical patch.
- Description, the full ui test run, the browser specs and the frame probe pass: not checked; CI runs once the pull request leaves draft.
- Description, the earlier merges of main were clean, kept the other pull request's tests with one shared
actimport, and left the change's own diff unchanged: verified from the history and imports. - Description, the newest merge of main has no conflicts, the touch trigger imports the gesture counter and Tooltip's hook imports the layer hook, both changed on main, both reach the click guard and the touch-end mark, and the change's own diff is unchanged: verified from the merged tree, the import chain and by comparing the two diffs.
- Description, the history of the later commits (main's detach result kept, the changeset wording, the committed-flag settle, the Effect note): verified from each commit.
- Description, the scope checklist (one defect, no tagalong, no new API, no internal context): verified.
.changeset/touch-trigger-refs-at-commit.md: clear.packages/core/src/Tooltip/useTooltip.tsx: clear.packages/core/src/Layer/useTouchTrigger.ts: clear.packages/core/src/Layer/useTouchTrigger.test.ts: clear.packages/core/src/HoverCard/HoverCard.test.tsx: clear.packages/core/src/Tooltip/Tooltip.test.tsx: clear.packages/core/src/Tooltip/useTooltip.showHide.test.tsx: clear.packages/core/src/Tooltip/useTooltip.test.tsx: clear.
Render-time ref writes fixed, each read in a callback:
isOpenRef,hideRef,layerIdRef,onReleaseInLayerRefandanswerTapRefincore/Layer/useTouchTrigger.ts, andhandlersRef,latestRefandisEnabledRefincore/Tooltip/useTooltip.tsx. Red-first: yes, seven new tests fail on main, one per ref butonReleaseInLayerRef.User impact
People who tap a HoverCard or a Tooltip on a touch screen, in an app that renders with transitions. The touch trigger kept its open state, its document listener's values and its tap answer in refs written during render. A render React discards, as a suspended transition does, left its values there. After a discarded render that disabled a hover card, a tap answered with that render's props, and the card did not open. After one that set a Tooltip's
isOpen, a tap did nothing, and a press outside left a shown tooltip open.Problem and solution fit
A write during render runs for every render, including the ones React throws away. A tap's
clickand a document listener read these refs after a commit, so they should hold the committed values.Each ref now comes from
useCommittedRef, Core's shared latest-value hook, which writes at commit. The tap's answer is a plain function in render, with its ref from the hook. SoisOpenRefgoes: only the committed answer runs, and it readsisOpen. Tooltip's handlers, controlled state and enabled flag come from the hook too. The trigger's ref cleanup runs before the commit's insertion Effects, so its detach only marks itself pending. The hook's layout Effect settles it from the committed flags, or a microtask does when the hook does not render. The callbacks that read the refs list them in their dependencies.Expected behavior and authority
useRefcontract: do not writeref.currentduring rendering, except to initialize it.architecture:react-component-runtimeINV3 and INV17: a latest-value ref goes throughuseCommittedRef, and render writes no ref. INV4: no rendered value comes from a ref mutation.Smallest restoration
Five refs in
useTouchTrigger.tsand three inuseTooltip.tsx. No API, visual or default changes.Evidence
Scope
Testing
All runs below are at this PR's head, 0b11850, unless a line names another commit.
Each test commits one set of props, then renders others in a transition while a sibling suspends for good, so React never commits that render. A finger then taps the trigger, or lifts outside it. The hook tests use
useTouchTriggerthe way a caller of the Layer entry point would.answerTapRefuseCommittedRefHoverCard.test.tsx: after a discarded render that disables the card, a tap opens the committed, enabled card.isOpenRefisOpenuseTouchTrigger.test.ts: after a discarded render that says the layer is open, a tap opens it.hideRefuseCommittedRefuseTouchTrigger.test.ts: a lift outside dismisses through the committedhide.layerIdRefuseCommittedRefuseTouchTrigger.test.ts: a lift inside the committed layer does not dismiss it.onReleaseInLayerRefuseCommittedRefhandlersRef(useTooltip.tsx)useCommittedRefTooltip.test.tsx: after a discarded render that controls the tooltip, a tap opens it.latestRef(useTooltip.tsx)useCommittedRefuseTooltip.showHide.test.tsx: after a discarded render that controls a shown tooltip, a press outside closes it.isEnabledRef(useTooltip.tsx)isEnabled, and the detach settles at commituseTooltip.test.tsx: a trigger its own component removes detaches as it does without a discarded render that disables the tooltip.pnpm exec vitest run --project ui: 1,012 files, 25,239 tests pass.useTooltip.test.tsxadds a focused trigger whose wiring swaps in a commit that disables it and holds it closed. Enabled again, it stays shut. The case passes on main and fails at a6e45c0, whose detach read the previous commit'sisOpen.isEnabledRefcase removes the trigger in a commit that does not render the hook, so it covers the microtask path. It fails on main and at f844669.console.error.useTouchTrigger.test.ts,HoverCard.test.tsx,Tooltip.test.tsx,useTooltip.showHide.test.tsxanduseTooltip.test.tsxrun whole against main 36f68b0's hook and Tooltip: the seven new tests fail, and the other 235 pass.@astryxdesign/coretypecheck: 0 errors. ESLint and Prettier on the changed files: clean.useCommittedRef. The next commit moves the five refs onto it in place of their layout effects.TooltipTallContent.a11y.browser.spec.ts:354failed 5 of 5 ("frame 0 covers the trigger"), as on main 1dbbc73.HoverCard.test.tsxandTooltip.test.tsxcases beside this PR's, and theactimport both sides added appears once..browserspecs in the WebKit container, 29 passed, the:354case included. Tooltip, DropdownMenu,LayerSamePressandLayerPanLightDismissinteraction specs: Chromium 56 passed (9 skipped), WebKit 34 passed (31 skipped).:popover-openin every frame. No frame paints the tooltip open after a commit that disables it, in Chromium and WebKit, three runs each, as on main. A control that disables two frames late shows two open frames, so the probe would see a one-frame flash.useTooltip.tsxreaches three of main's changes:Layer/layerAnimations.stylex.ts, which it imports,Layer/layerEntranceSide.tsandutils/clickGuard.ts. The change's own diff is unchanged.useTooltip.tsxreaches five of main's changes since a4595ef:utils/themeProps.ts, which it imports,Layer/layerEntranceSide.ts,utils/sharedResizeObserver.ts,theme/generateThemeRules.tsandtheme/tokenReferences.ts;useTouchTrigger.tsreaches four of the same. The change's own diff is unchanged.useTouchTrigger.tsimportsLayer/gestureCounter.ts, which changed on main since 723a112.useTooltip.tsximportsLayer/useLayer.tsx, which changed too. Both also reachutils/clickGuard.tsandutils/touchEndMark.ts. The change's own diff is unchanged.