Skip to content

fix(useTouchTrigger): sync its callback refs at commit - #10892

Merged
cixzhang merged 13 commits into
meta:mainfrom
vjeux:fix/touch-trigger-refs-at-commit
Nov 13, 2026
Merged

cixzhang merged 13 commits into
meta:mainfrom
vjeux:fix/touch-trigger-refs-at-commit

Conversation

@vjeux

@vjeux vjeux commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Render-time ref writes fixed, each read in a callback: isOpenRef, hideRef, layerIdRef, onReleaseInLayerRef and answerTapRef in core/Layer/useTouchTrigger.ts, and handlersRef, latestRef and isEnabledRef in core/Tooltip/useTooltip.tsx. Red-first: yes, seven new tests fail on main, one per ref but onReleaseInLayerRef.

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 click and 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. So isOpenRef goes: only the committed answer runs, and it reads isOpen. 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

  • React's useRef contract: do not write ref.current during rendering, except to initialize it.
  • architecture:react-component-runtime INV3 and INV17: a latest-value ref goes through useCommittedRef, and render writes no ref. INV4: no rendered value comes from a ref mutation.

Smallest restoration

Five refs in useTouchTrigger.ts and three in useTooltip.tsx. No API, visual or default changes.

Evidence

  • Reproduction before the change: the seven new tests fail on main 36f68b0, whole files run.
  • Result after the change, at 0b11850: they pass.
  • Representative unchanged path: the existing tap and outside-tap tests for Tooltip, HoverCard and Popover still pass.
  • Regression test or other mutation-sensitive proof: each test fails while its ref is written during render.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

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 useTouchTrigger the way a caller of the Layer entry point would.

Ref Now Red-first test
answerTapRef useCommittedRef HoverCard.test.tsx: after a discarded render that disables the card, a tap opens the committed, enabled card.
isOpenRef Removed: the committed answer reads isOpen useTouchTrigger.test.ts: after a discarded render that says the layer is open, a tap opens it.
hideRef useCommittedRef useTouchTrigger.test.ts: a lift outside dismisses through the committed hide.
layerIdRef useCommittedRef useTouchTrigger.test.ts: a lift inside the committed layer does not dismiss it.
onReleaseInLayerRef useCommittedRef No new test. Only Tooltip passes it, as a stable callback, so a discarded render leaves the same value.
handlersRef (useTooltip.tsx) useCommittedRef Tooltip.test.tsx: after a discarded render that controls the tooltip, a tap opens it.
latestRef (useTooltip.tsx) useCommittedRef useTooltip.showHide.test.tsx: after a discarded render that controls a shown tooltip, a press outside closes it.
isEnabledRef (useTooltip.tsx) Removed: the committed handlers carry isEnabled, and the detach settles at commit useTooltip.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.tsx adds 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's isOpen.
  • The isEnabledRef case 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.
  • A guard unmounts a disabled, uncontrolled tooltip: its detach settles after the unmount, with no error and no console.error.
  • useTouchTrigger.test.ts, HoverCard.test.tsx, Tooltip.test.tsx, useTooltip.showHide.test.tsx and useTooltip.test.tsx run whole against main 36f68b0's hook and Tooltip: the seven new tests fail, and the other 235 pass.
  • @astryxdesign/core typecheck: 0 errors. ESLint and Prettier on the changed files: clean.
  • History: main merged at 7e7fbae on Nov 11, with no conflicts, so CI runs on a current base. The change's own diff is unchanged.
  • History: the merge of main 6ef8ba1 on Nov 12 has no conflicts and brings useCommittedRef. The next commit moves the five refs onto it in place of their layout effects.
  • Browser specs at a6e45c0, whose touch trigger this head keeps: HoverCard, Tooltip and TouchTrigger a11y specs, Chromium 76 passed. The a11y browser specs in the CI-profile WebKit container: 28 passed. TooltipTallContent.a11y.browser.spec.ts:354 failed 5 of 5 ("frame 0 covers the trigger"), as on main 1dbbc73.
  • History: the merge of main 1dbbc73 on Nov 12 has no conflicts. It keeps fix(Text, Tooltip): on Android, the first tap on a button or link in truncated text opens its tooltip; a tap on a text field never does #11213's new HoverCard.test.tsx and Tooltip.test.tsx cases beside this PR's, and the act import both sides added appears once.
  • Browser specs at this head: Tooltip, SideNav, HoverCard and TouchTrigger a11y specs, Chromium 81 passed; their .browser specs in the WebKit container, 29 passed, the :354 case included. Tooltip, DropdownMenu, LayerSamePress and LayerPanLightDismiss interaction specs: Chromium 56 passed (9 skipped), WebKit 34 passed (31 skipped).
  • A frame probe at 55fffb8, a temporary story outside this PR, records :popover-open in 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.
  • History: a commit after the merge keeps the detach check on main's behavior.
  • History: a changeset-only commit names the controlled state the handlers read.
  • History: the next commit settles the detach on the committed flags, so no render-time write is left in the change.
  • History: a commit after the review names the popover the detach Effect synchronizes, and the flags the handlers carry.
  • History: the merge of main a4595ef on Nov 12 has no conflicts. useTooltip.tsx reaches three of main's changes: Layer/layerAnimations.stylex.ts, which it imports, Layer/layerEntranceSide.ts and utils/clickGuard.ts. The change's own diff is unchanged.
  • History: the merge of main 723a112 on Nov 12 has no conflicts. useTooltip.tsx reaches five of main's changes since a4595ef: utils/themeProps.ts, which it imports, Layer/layerEntranceSide.ts, utils/sharedResizeObserver.ts, theme/generateThemeRules.ts and theme/tokenReferences.ts; useTouchTrigger.ts reaches four of the same. The change's own diff is unchanged.
  • History: the merge of main 36f68b0 on Nov 12 has no conflicts. useTouchTrigger.ts imports Layer/gestureCounter.ts, which changed on main since 723a112. useTooltip.tsx imports Layer/useLayer.tsx, which changed too. Both also reach utils/clickGuard.ts and utils/touchEndMark.ts. The change's own diff is unchanged.

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

vercel Bot commented Nov 9, 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 13, 2026 4:57am UTC

Request Review

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

astracat-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 13, 2026, 5:01 AM UTC

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 0b11850

Storybook · Sandbox · built from this PR's head

Modified components

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

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 9, 2026
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 4bf8c32

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

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 through answerTapRef.
  • The header of useTouchTrigger.test.ts still lists only the pure helpers in @input and @output; add useTouchTrigger and the discarded-render cases.
  • The description quotes architecture:react-component-runtime INV3 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]

@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: 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, because useTooltip sends the trigger's pointerdown through handlersRef, 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 assign handlersRef at 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.

Automated review (maintainer link)

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.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec d33c531

@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: 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, because useTooltip sends the trigger's pointerdown through handlersRef, 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 move handlersRef onto useCommittedRef.
  • 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.

Automated review (maintainer link)

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.
@vjeux

vjeux commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Answers to the review of d33c531, at e3428b6: Tooltip's handler and controlled-state refs move to useCommittedRef. Two new tests tap, and press outside, after a discarded render that sets isOpen. isEnabledRef stays, since the trigger's ref cleanup reads it before any insertion effect. The #10639 line is gone, and the four smaller notes are done.

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec e3428b6

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

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:735 calls 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-394 reads 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.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 12, 2026 12:17
@vjeux
vjeux marked this pull request as draft November 12, 2026 13:12
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec a6e45c0

@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: 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 calls onHide, but its note names no external system, which architecture:react-component-runtime INV3 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 act import: 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.

Automated review (maintainer link)

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.
@vjeux

vjeux commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Answers to the review of 11b8aae, at 04d9c2f: the detach Effect names the popover it synchronizes, and the changeset names the flags the handlers carry. The comment that restated a call is gone.

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 04d9c2f

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

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 act import: 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.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 7a3357c

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

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 act import: 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.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 12, 2026 20:15
@vjeux
vjeux marked this pull request as draft November 12, 2026 20:51
@vjeux
vjeux marked this pull request as ready for review November 12, 2026 20:59
@vjeux
vjeux marked this pull request as draft November 12, 2026 21:44
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 0146d2b

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

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:317 passes).
  • 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 act import: 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.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 13, 2026 02:13
@vjeux
vjeux marked this pull request as draft November 13, 2026 02:57
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 0b11850

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

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:317 passes).
  • 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 act import, 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.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 13, 2026 05:12
@cixzhang
cixzhang merged commit 1d48cc5 into meta:main Nov 13, 2026
137 checks passed
@vjeux
vjeux deleted the fix/touch-trigger-refs-at-commit branch November 13, 2026 06:10

This branch was successfully deployed

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

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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.

2 participants