Skip to content

perf(Layer): keep the tap recognizer apart from the touch trigger, so Text's first load drops 9.6 KB - #11599

Merged
cixzhang merged 11 commits into
mainfrom
perf/tap-recognizer-gesture-counter
Nov 15, 2026
Merged

cixzhang merged 11 commits into
mainfrom
perf/tap-recognizer-gesture-counter

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

A page that renders Text or Heading loads less JavaScript before first paint. Text's truncation tooltip waits for a tap with useTapRecognizer, a 40-line hook that needs only the gesture counter. The hook lived in Layer/useTouchTrigger. Bundlers split code per file, and the lazily loaded tooltip uses all of useTouchTrigger. So everything the tooltip needs from that file landed in Text's first load: the rest of useTouchTrigger, the keyboard-height and interaction-modality code, and the clickable-container walk. This PR is a pure move; no narrower template covers a performance change, so it uses "other".

User or maintainer impact

  • People loading a page whose components bring no tooltip code (for example Text and Heading only: an article, a list of labels) download 9.6 KB less JavaScript before first paint (3.4 KB gzip, −32%). A page that also renders a component with a tooltip (Avatar, StatusDot, Thumbnail, Banner, Button, Link, a form field…) keeps the touch trigger and changes by a few bytes.
  • Pages with a Button, a Link, a menu or a form field: no change today. About 31 components import Tooltip or HoverCard statically, so the touch trigger stays in those pages' first load either way. This PR adds about 35 bytes there. It pays on those pages once their tooltips stop being static imports, a separate decision.
  • No behavior change: tapping a truncated text opens its tooltip as before (Android Chrome take below).

Problem and solution fit

  • createTapRecognizer, useTapRecognizer, the TapRecognizer type and TOUCH_POINTER_TYPES move from Layer/useTouchTrigger to the existing Layer/gestureCounter, which the recognizer already depends on (currentGesture). useTouchTrigger and Text/TruncationTooltip import them from there. No new module and no public API.
  • The import-boundary check lists Layer/gestureCounter as a touch module, because it now holds the touch tap recognizer. The truncation tooltip's allowlist row moves with the recognizer: Text/TruncationTooltip → Layer/gestureCounter, with the same entries, invariants (INV1, INV8) and exit condition.
  • Not done here, measured and dropped:
    • Cutting useClickableContainer → pressFeedback saves 0 bytes: only cancelPress is imported, and it tree-shakes.
    • Making pressGesture's module-level token read lazy saves 1.0 KB on Button and Link pages, under the 2 KB bar.
    • Moving isTextEntryControl out of keyboardHeight makes things worse when combined with this PR.

Authority

  • architecture:component-import-boundaries INV1 and INV8 and the allowlist (DEC-3). Specs confirmed the row re-target is the same crossing at a new address and needs no owner stamp. Specs also confirmed the hook belongs in gestureCounter and that gestureCounter joins INV8's touch-module list.
  • architecture:react-component-runtime INV3: the moved Effect names what it syncs (the trigger's tap listeners).
  • No behavior record changes; component:Text's truncation tooltip contract is unchanged.

Change and evidence

Page-level first-load bytes

Base a7ce61d3 → this head. Core's src was compiled with its Babel config, keeping Core's sideEffects. Then esbuild built one app bundle per page (minified, ESM, code splitting on, bare imports external). First load is the entry chunk plus its static imports; gzip is level 9.

Page (components) Base min / gzip Head min / gzip Change
Text page (Text, Heading) 30,182 / 11,154 20,569 / 7,704 −9,613 / −3,450
Docs page (Text, Heading, Link, Card, Divider, List) 182,221 / 60,237 182,256 / 60,246 +35 / +9
Form page (Button, IconButton, TextInput, CheckboxInput, Text, Heading, Card) 205,387 / 68,210 205,422 / 68,224 +35 / +14
Menu page (DropdownMenu, ContextMenu, Button, Text) 330,458 / 113,787 330,493 / 113,815 +35 / +28
Table page (Table, Text, Button) 357,816 / 124,627 357,851 / 124,629 +35 / +2

A Vite (Rolldown) build of a one-Text page agrees: entry chunk 249,304 → 240,334 bytes, with the difference moving into the lazily loaded tooltip chunk. The repository's boundary check prints Text 12.4 → 9.0 KB and Heading 12.8 → 9.5 KB eager gzip; other entries are unchanged.

Behavior

  • Pure move: same code, same tests. Red-first does not apply, because no behavior changes.
  • Android emulator, Chrome 133: a page with a one-line truncated Text, built from base and from head. One real touch tap (adb shell input tap) on the text opens its tooltip on both builds, with identical screenshots (head taken twice).
  • gestureCounter is a shared Layer module, so other open PRs that carry device evidence over Layer modules need to retake their checks after this merges.

Scope

Components: Text, Heading (through the truncation tooltip), Layer (gestureCounter, useTouchTrigger)

  • This PR has one primary intent.
  • Independently removable deltas were removed or split.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

Record changed: architecture:component-import-boundaries. The allowlist row's crossing now reads Text/TruncationTooltip → Layer/gestureCounter, and its exit cell adds "the row moves with the recognizer". Every allowlist cost cell, the matching Current-state impact lines, and Table's eager total now carry the boundary check's printout at this head. The new crossing costs 1.7 KB gzip for Text and Heading. Button's and Link's tooltip rows rise (19.5 and 21.6 KB): with the recognizer out of useTouchTrigger, the touch trigger code is now theirs alone. The Table rows (88.5 and 3.6 KB) and Table's 134.5 KB eager total also carry drift from main (merged in at this head). The figures match the boundary check's printout on current main, the same check CI runs.

  • R1 narration: none; the exit cell states a present-tense rule.
  • R2 research: none.
  • R3 evidence: none cited in the record.
  • R4 rejected alternatives: none added.
  • R5 change references: none.
  • R6 open questions: none.

Testing

  • vitest run --project ui packages/core/src/Layer packages/core/src/Text packages/core/src/Tooltip packages/core/src/HoverCard packages/core/src/Heading: 45 files, 1,267 tests pass.
  • vitest run --project node scripts/check-component-import-boundaries.test.mjs scripts/core-single-bundle.test.mjs: pass.
  • pnpm check:component-import-boundaries --base-ref origin/main: boundaries hold.
  • pnpm -F @astryxdesign/core typecheck, ESLint on changed files, pnpm check:knowledge, shared-identity check: pass.
  • Android emulator tap-to-open on a truncated Text: pass on base and head.

Text's truncation tooltip waits for a tap with useTapRecognizer, a small
hook that needs only the gesture counter. It lived in useTouchTrigger,
which the lazily loaded tooltip uses in full, so bundlers put all of
useTouchTrigger, keyboardHeight, interactionModality and the clickable
container walk in Text's first load. The recognizer, its type and
TOUCH_POINTER_TYPES now live in gestureCounter, which useTouchTrigger
already imports. No behavior change.

The import-boundary check lists gestureCounter as a touch module, and
the truncation tooltip's allowlist row moves with the recognizer.
@vercel

vercel Bot commented Nov 13, 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 15, 2026 1:09am UTC

Request Review

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

astracat-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 15, 2026, 1:20 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec ba025f4

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 9f0436a

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) — ✓ · ✓ · ✗
Table 138.6 kB (+52 B) · 19.4 kB CSS (0) — — · — · —
Markdown 201.9 kB (+49 B) · 21.7 kB CSS (0) — — · — · —
116 more components
Component Size LoC Visual · A11y · RTL
TimeInput 174.7 kB (+41 B) · 16.9 kB CSS (0) — — · — · —
Tokenizer 103.6 kB (+37 B) · 20.1 kB CSS (0) — — · — · —
charts/ChartTooltip 214.6 kB (+36 B) · 451 B CSS (0) — — · — · —
ChatComposerInput 82.0 kB (+35 B) · 12.1 kB CSS (0) — — · — · —
ChatComposerTokenElement 82.0 kB (+35 B) · 12.1 kB CSS (0) — — · — · —
CheckboxInput 68.9 kB (+35 B) · 10.1 kB CSS (0) — — · — · —
ContextMenu 120.4 kB (+34 B) · 18.4 kB CSS (0) — — · — · —
DateRangeInput 99.2 kB (+32 B) · 13.3 kB CSS (0) — — · — · —
HoverCard 30.1 kB (+32 B) · 4.5 kB CSS (0) — — · — · —
TextArea 66.7 kB (+32 B) · 9.4 kB CSS (0) — — · — · —
DialogHeader 67.8 kB (+31 B) · 12.3 kB CSS (0) — — · — · —
richtext/RichTextView 282.0 kB (+31 B) · 2.3 kB CSS (0) — — · — · —
ChatComposer 84.4 kB (+30 B) · 12.9 kB CSS (0) — — · — · —
NumberInput 77.4 kB (+30 B) · 12.2 kB CSS (0) — — · — · —
SideNavItem 76.8 kB (+30 B) · 11.9 kB CSS (0) — — · — · —
Stepper 66.6 kB (+28 B) · 10.9 kB CSS (0) — — · — · —
TopNavMenu 81.4 kB (+27 B) · 12.0 kB CSS (0) — — · — · —
Lightbox 145.8 kB (+26 B) · 11.9 kB CSS (0) — — · — · —
TableCell 121.6 kB (+26 B) · 18.9 kB CSS (0) — — · — · —
charts/Chart 237.4 kB (+25 B) · 516 B CSS (0) — — · — · —
TextInput 72.6 kB (+24 B) · 12.0 kB CSS (0) — — · — · —
AppShell 97.4 kB (+23 B) · 14.3 kB CSS (0) — — · — · —
ComplexSelector 77.5 kB (+23 B) · 12.6 kB CSS (0) — — · — · —
TableHeaderCell 121.3 kB (+23 B) · 18.7 kB CSS (0) — — · — · —
Toast 103.5 kB (+23 B) · 11.1 kB CSS (0) — — · — · —
CodeBlock 80.0 kB (+21 B) · 12.1 kB CSS (0) — — · — · —
lab/ChatReactionBar 114.5 kB (+21 B) · 1.1 kB CSS (0) — — · — · —
lab/TabBarMoreList 101.7 kB (+21 B) · 1.8 kB CSS (0) — — · — · —
lab/TransferList 111.8 kB (+21 B) · 1.2 kB CSS (0) — — · — · —
ChatLayout 88.2 kB (+20 B) · 11.3 kB CSS (0) — — · — · —
TabMenu 78.7 kB (+20 B) · 11.9 kB CSS (0) — — · — · —
ToggleButton 91.9 kB (+20 B) · 10.9 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 113.4 kB (+20 B) · 773 B CSS (0) — — · — · —
richtext/RichTextEditor 305.4 kB (+20 B) · 2.6 kB CSS (0) — — · — · —
IconButton 64.9 kB (+19 B) · 10.8 kB CSS (0) — — · — · —
MoreMenu 107.1 kB (+19 B) · 18.6 kB CSS (0) — — · — · —
lab/DialogHeroHeader 88.5 kB (+19 B) · 372 B CSS (0) — — · — · —
TableSelectionToolbar 75.1 kB (+18 B) · 14.0 kB CSS (0) — — · — · —
BreadcrumbItem 96.3 kB (+17 B) · 13.1 kB CSS (0) — — · — · —
DateInput 199.9 kB (+17 B) · 17.9 kB CSS (0) — — · — · —
PowerSearch 306.2 kB (+17 B) · 25.5 kB CSS (0) — — · — · —
RadioListItem 75.8 kB (+17 B) · 10.5 kB CSS (0) — — · — · —
TopNavHeading 82.0 kB (+17 B) · 12.0 kB CSS (0) — — · — · —
lab/CommentComposer 162.5 kB (+17 B) · 1.9 kB CSS (0) — — · — · —
lab/Comments 369.6 kB (+17 B) · 2.5 kB CSS (0) — — · — · —
lab/Schedule 114.5 kB (+17 B) · 3.9 kB CSS (0) — — · — · —
Button 64.9 kB (+16 B) · 10.8 kB CSS (0) — — · — · —
DateTimeInput 223.3 kB (+16 B) · 19.7 kB CSS (0) — — · — · —
lab/TourStep 93.0 kB (+16 B) · 691 B CSS (0) — — · — · —
BaseTypeahead 78.2 kB (+15 B) · 11.7 kB CSS (0) — — · — · —
FieldLabel 55.2 kB (+15 B) · 5.8 kB CSS (0) — — · — · —
FileInput 74.0 kB (+15 B) · 11.7 kB CSS (0) — — · — · —
TopNavMegaMenu 75.9 kB (+15 B) · 12.6 kB CSS (0) — — · — · —
Calendar 76.0 kB (+14 B) · 11.4 kB CSS (0) — — · — · —
Field 59.3 kB (+14 B) · 7.3 kB CSS (0) — — · — · —
Link 56.2 kB (+14 B) · 7.1 kB CSS (0) — — · — · —
SideNav 121.1 kB (+14 B) · 12.2 kB CSS (0) — — · — · —
SideNavCollapseButton 65.7 kB (+14 B) · 10.8 kB CSS (0) — — · — · —
Tooltip 32.0 kB (+14 B) · 4.5 kB CSS (0) — — · — · —
ChatSendButton 65.3 kB (+12 B) · 10.8 kB CSS (0) — — · — · —
StatusDot 33.7 kB (+12 B) · 5.4 kB CSS (0) — — · — · —
InputGroup 60.9 kB (+11 B) · 7.9 kB CSS (0) — — · — · —
SideNavHeading 82.4 kB (+11 B) · 12.1 kB CSS (0) — — · — · —
TabList 47.2 kB (+11 B) · 6.5 kB CSS (0) — — · — · —
ChatLayoutScrollButton 65.5 kB (+10 B) · 11.0 kB CSS (0) — — · — · —
InfoTip 50.3 kB (+10 B) · 5.4 kB CSS (0) — — · — · —
Thumbnail 69.2 kB (+10 B) · 12.3 kB CSS (0) — — · — · —
Banner 66.9 kB (+9 B) · 11.3 kB CSS (0) — — · — · —
TopNav 77.9 kB (+9 B) · 11.7 kB CSS (0) — — · — · —
lab/CommentPin 60.2 kB (+9 B) · 1.2 kB CSS (0) — — · — · —
lab/TransferListSelector 120.7 kB (+9 B) · 1.4 kB CSS (0) — — · — · —
AvatarGroup 48.6 kB (+8 B) · 5.8 kB CSS (0) — — · — · —
ChatDictationButton 65.4 kB (+8 B) · 10.8 kB CSS (0) — — · — · —
MobileNavToggle 65.2 kB (+8 B) · 10.8 kB CSS (0) — — · — · —
Popover 98.4 kB (+8 B) · 15.1 kB CSS (0) — — · — · —
Toolbar 47.0 kB (+8 B) · 8.1 kB CSS (0) — — · — · —
lab/CommentThread 362.2 kB (+8 B) · 2.4 kB CSS (0) — — · — · —
RadioList 60.7 kB (+6 B) · 7.3 kB CSS (0) — — · — · —
Switch 108.8 kB (+6 B) · 10.0 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 299.3 kB (+6 B) · 454 B CSS (0) — — · — · —
Avatar 45.8 kB (+5 B) · 5.7 kB CSS (0) — — · — · —
lab/DiffViewer 92.8 kB (+5 B) · 2.1 kB CSS (0) — — · — · —
DrawerHeader 67.9 kB (+4 B) · 13.7 kB CSS (0) — — · — · —
Pagination 123.6 kB (+4 B) · 18.9 kB CSS (0) — — · — · —
DropdownMenu 106.8 kB (+3 B) · 18.6 kB CSS (0) — — · — · —
Slider 114.3 kB (+3 B) · 8.9 kB CSS (0) — — · — · —
CheckboxList 73.0 kB (+2 B) · 7.8 kB CSS (0) — — · — · —
Selector 112.6 kB (+2 B) · 18.5 kB CSS (0) — — · — · —
Typeahead 87.5 kB (+2 B) · 13.3 kB CSS (0) — — · — · —
MobileNav 76.1 kB (+1 B) · 11.4 kB CSS (0) — — · — · —
ProgressBar 11.9 kB (0) · 6.4 kB CSS (0) — — · — · —
lab/ListInput 93.4 kB (0) · 922 B CSS (0) — — · — · —
AvatarGroupOverflow 51.8 kB (−2 B) · 5.7 kB CSS (0) — — · — · —
NavHeadingMenu 18.5 kB (−2 B) · 3.5 kB CSS (0) — — · — · —
Carousel 74.5 kB (−3 B) · 11.7 kB CSS (0) — — · — · —
lab/EmojiPicker 92.3 kB (−4 B) · 751 B CSS (0) — — · — · —
AlertDialog 128.5 kB (−7 B) · 15.4 kB CSS (0) — — · — · —
lab/SelectableCardGroup 68.6 kB (−7 B) · 162 B CSS (0) — — · — · —
MultiSelector 101.3 kB (−10 B) · 17.7 kB CSS (0) — — · — · —
ListItem 78.8 kB (−15 B) · 11.9 kB CSS (0) — — · — · —
CheckboxListItem 79.6 kB (−16 B) · 11.9 kB CSS (0) — — · — · —
SegmentedControl 101.9 kB (−21 B) · 6.9 kB CSS (0) — — · — · —
DropdownMenuSubMenu 77.9 kB (−1.2 kB) · 10.3 kB CSS (0) — — · — · —
CommandPalette 77.8 kB (−1.3 kB) · 12.7 kB CSS (0) — — · — · —
CommandPaletteInput 32.9 kB (−1.4 kB) · 7.6 kB CSS (0) — — · — · —
lab/LineClamp 13.5 kB (−2.9 kB) · 168 B CSS (0) — — · — · —
Spinner 24.0 kB (−3.2 kB) · 6.3 kB CSS (0) — — · — · —
ChatMessageList 27.3 kB (−3.3 kB) · 7.1 kB CSS (0) — — · — · —
ChatToolCalls 31.6 kB (−3.3 kB) · 8.4 kB CSS (0) — — · — · —
Heading 11.5 kB (−3.3 kB) · 5.5 kB CSS (0) — — · — · —
Text · Storybook 11.0 kB (−3.3 kB) · 5.5 kB CSS (0) 740 (0) ✓ · ✓ · —
Timer 13.1 kB (−3.3 kB) · 6.1 kB CSS (0) — — · — · —
Timestamp 26.9 kB (−8.9 kB) · 11.0 kB CSS (0) — — · — · —
charts/ChartLegend 40.3 kB (−16.3 kB) · 224 B CSS (0) — — · — · —
layer — — — · ✓ · —
Layer — — ✓ · ✓ · —

Package size: @astryxdesign/core 7.59 MB packed (+443 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026

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

Requesting changes: the recognizer move is sound and keeps behavior identical, but two statements about its size need correcting first.

  • The changeset (.changeset/text-tap-recognizer-first-load.md) promises the saving to any page with Text or Heading and no Button, Link or form field, but pages that also render Avatar, StatusDot, Thumbnail or Banner keep the touch trigger and change by −5 to +24 bytes gzip, so please narrow it to pages whose components bring no tooltip code (about 3.4 KB gzip less).
  • The re-targeted allowlist row in docs/architecture/component-import-boundaries.md keeps the old crossing's 4.6 KB (Text, Heading) cost, as does the Current-state impact line, while the boundary check prices the new Text/TruncationTooltip → Layer/gestureCounter crossing at about 1.7 KB, so please refresh those figures (and the Button, Link and Table context-menu rows the move shifts) from the check's printout at the final head.

One non-blocking suggestion: the sentence added to the gestureCounter.ts header could be shorter (see the inline note).

Claims and files checked
  • Changeset: a page with Text or Heading and no Button, Link or form field loads about 9.6 KB (3.5 KB gzip) less. False as scoped: Text alone saves 3,440 B gzip, but Text with Avatar, StatusDot, Thumbnail or Banner changes by −5 to +24 B.
  • Changeset: the tooltip's tap handling no longer shares a file with the touch trigger, which now stays with the lazily loaded tooltip. Verified: the touch trigger leaves the eager chunks of Text and Heading pages.
  • Changeset and description: tapping a truncated text opens its tooltip as before. Verified: the moved code is identical, and 1,267 Layer, Text, Tooltip, HoverCard and Heading tests pass.
  • Description: the recognizer is a small hook that needs only the gesture counter. Verified: its only Core dependency is currentGesture.
  • Description: a pure move with no new module and no public API change. Verified: no file is added, and the API report lists no rows.
  • Description: pages with a Button, Link, menu or form field see no change apart from about 35 bytes. Verified: Button, IconButton, Link and Table eager sizes are unchanged, and tested pages grow by 35 minified bytes.
  • Description: about 31 components import Tooltip or HoverCard statically. Verified: 31 folders do.
  • Description: the boundary check lists the gesture counter as a touch module, and the row keeps its entries, invariants and exit condition. Verified by the check's output.
  • Description: the check prints Text 12.4 → 9.0 KB and Heading 12.8 → 9.5 KB. Verified within 0.1 KB.
  • Description: the page-level table and the Vite figures. The Text row reproduces (−9,615 minified bytes); the Vite build was not re-run.
  • Description: the moved Effect names what it synchronizes. Verified.
  • Description: the re-targeted row needs no further owner approval. Moot: an engineering owner approved this head.
  • Description: the measured and dropped alternatives. Outside this change; only "just one press-feedback helper is imported" was checked, and it is true.
  • Description: the record's cost cell keeps the CI figure. True, and that is the second finding.
  • Description: tests, typecheck, ESLint and the knowledge check pass. Verified.
  • Description: the Android emulator tap check passed on base and head. Stated in text; not re-run.
  • .changeset/text-tap-recognizer-first-load.md: first finding.
  • docs/architecture/component-import-boundaries.md: second finding.
  • packages/core/src/Layer/gestureCounter.ts: clear (non-blocking header note).
  • packages/core/src/Layer/useTouchTrigger.ts: clear.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • scripts/check-component-import-boundaries.mjs: clear.
  • scripts/check-component-import-boundaries.test.mjs: clear.

Automated review (maintainer link)

…m the check; scope the changeset to pages with no tooltip code
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec af7d85d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026

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

Requesting changes: the recognizer move keeps behavior identical and the changeset scopes its saving correctly, but the boundary record still misstates what three crossings cost after the move.

  • docs/architecture/component-import-boundaries.md keeps 15.5, 17.6 and 78.2 KB for the Button, Link and Table context-menu rows and their Current-state impact lines while the boundary check prints 19.5, 21.6 and 85.9 KB at this head (16.4, 18.5 and 84.5 KB at the base), so please refresh those figures from the check's printout and correct the description's statement that those rows differ by the same amount at base and head.

One non-blocking suggestion: the gestureCounter.ts file header is now 23 lines, past the budget of about 12, and its new @output text repeats the export names.

Claims and files checked
  • Changeset: a page whose components bring no tooltip code, such as Text and Heading only, loads about 9.6 KB (3.4 KB gzip) less before first paint. Verified: a Text and Heading page drops 9,615 B minified and 3,445 B gzip.
  • Changeset: the tooltip's tap handling no longer shares a file with the touch trigger, which stays with the lazily loaded tooltip. Verified: the truncation tooltip imports the recognizer from the gesture counter (TruncationTooltip.tsx:30), and the touch trigger leaves the eager chunks of Text and Heading pages.
  • Changeset and description: tapping a truncated text opens its tooltip as before. Verified: the moved code is identical apart from two comments, and 1,267 Layer, Text, Tooltip, HoverCard and Heading tests pass.
  • Description: the recognizer is a small hook that needs only the gesture counter. Verified: its only Core dependency is currentGesture.
  • Description: the lazily loaded tooltip uses all of the touch trigger, so its keyboard-height, modality and clickable-container code landed in Text's first load. Verified from the touch trigger's imports and the first-load chunks.
  • Description: pages with no tooltip code save 9.6 KB, 3.4 KB gzip, 32%. The byte savings reproduce; the percentage is the minified ratio of the description's own table and depends on the build.
  • Description: pages with a component that has a tooltip keep the touch trigger and change by about 35 bytes. Verified: +35 B minified, +3 to +24 B gzip.
  • Description: about 31 components import Tooltip or HoverCard statically. Verified: 30 component folders do.
  • Description: a pure move with no new module and no public API change. Verified: no file is added, and the API report lists no rows.
  • Description: the boundary check lists the gesture counter as a touch module, and the row keeps its entries, invariants and exit condition. Verified by the check's output; the exit cell gains one clause.
  • Description: the re-targeted row needs no further owner approval. Moot: the record owner approved this head.
  • Description: the moved Effect names what it synchronizes, and no behavior record changes. Verified.
  • Description: the measured alternatives that were dropped. Outside this change; only "just one press-feedback helper is imported" was checked, and it holds.
  • Description: the page-level table and the Vite figures. The deltas reproduce (−9,615 B against −9,613 B for the Text page, +35 B elsewhere); the Vite build was not re-run.
  • Description: the check prints Text 12.4 → 9.0 KB and Heading 12.8 → 9.5 KB, other entries unchanged. Verified within 0.1 KB.
  • Description: the Android emulator tap check passed on base and head. Stated in text; not re-run.
  • Description: the record's re-targeted row and impact line carry the check's 1.7 KB. Verified.
  • Description: the other rows' costs differ from the check's printout by the same amount at base and head. False: Button 16.4 → 19.5 KB, Link 18.5 → 21.6 KB, Table context menu 84.5 → 85.9 KB (the finding above).
  • Description: tests, typecheck, ESLint, the boundary check and the knowledge check pass. Verified.
  • Description: other open pull requests with device evidence over Layer modules retake it after this lands. Advisory for other pull requests; outside this change.
  • .changeset/text-tap-recognizer-first-load.md: clear.
  • docs/architecture/component-import-boundaries.md: the finding above.
  • packages/core/src/Layer/gestureCounter.ts: clear (non-blocking header note).
  • packages/core/src/Layer/useTouchTrigger.ts: clear.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • scripts/check-component-import-boundaries.mjs: clear.
  • scripts/check-component-import-boundaries.test.mjs: clear.

Automated review (maintainer link)

Comment on lines +11 to +13
* release is handled), the press claims (claimPress,
* claimContextMenuPress), and the touch tap recognizer (useTapRecognizer,
* TOUCH_POINTER_TYPES)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking (comment style): the file header is now 23 lines, past the budget of about 12, and this addition repeats the export names. The @position sentence below already gives the reason the recognizer lives here, so this list can go.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 2a71cdf

@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; it runs once the pull request is marked ready for review.

The tap recognizer moves into gestureCounter with identical code, the boundary check holds, and every allowlist cost and impact figure now matches the check's printout, which resolves the earlier request.

  • Non-blocking: the gestureCounter.ts file header is 23 lines, past the budget of about 12, and the added @output text restates the export names; the @position sentence already says why the recognizer lives there, so that addition can go.
Claims and files checked
  • Claim, changeset: a page with only Text and Heading loads about 9.6 KB less JavaScript (about 3.4 KB gzip) before first paint. Verified: −9,615 B minified and −3,440 / −3,445 B gzip in a first-load build of each page.
  • Claim, changeset: the tap handling no longer shares a file with the touch trigger, which stays with the lazily loaded tooltip. Verified: useTouchTrigger and the keyboard-height code leave the first load of a Text page (TruncationTooltip.tsx:30).
  • Claim: tapping a truncated text opens its tooltip as before, with no behavior change. Verified: the moved code is identical apart from two comments, and 1,267 tests across Layer, Text, Tooltip, HoverCard and Heading pass.
  • Claim: pages that also render a component with a tooltip keep the touch trigger and change by a few bytes. Verified: +35 B against the merge base, −79 to +35 B against the current base because of unrelated base-branch changes.
  • Claim: about 31 components import Tooltip or HoverCard statically. Verified approximately: 30 component folders do.
  • Claim: the four moved names now live in gestureCounter, both consumers import them from there, with no new module and no public API change. Verified: gestureCounter.ts:426-510; the API generator lists no added, changed or removed rows.
  • Claim: the boundary check counts gestureCounter as a touch module and the allowlist row keeps its entries and invariants. Verified: check-component-import-boundaries.mjs:105, the record's row, and a passing check.
  • Claim: the clickable-container's press-feedback import costs nothing because only cancelPress is imported. Verified for the import (useClickableContainer.ts:30); the byte figure was not re-measured.
  • Claim: two other measured alternatives (a lazy token read, moving the text-entry check) were dropped. Not re-measured: they are outside this change.
  • Claim: re-targeting the allowlist row needs no owner approval. Moot: the record's owner approved the record at this head.
  • Claim: the moved Effect names what it synchronizes. Verified: gestureCounter.ts:461-462.
  • Claim: the page-level byte table and the boundary check's eager sizes (Text 12.4 → 9.0 KB, Heading 12.8 → 9.5 KB, other entries unchanged). Verified: the check prints the same deltas, with Heading at 12.9 → 9.5 KB; the separate Vite figure was not reproduced.
  • Claim: an Android emulator tap opens the tooltip on base and head. Accepted as stated in text; the no-change claim rests on code identity.
  • Claim: every allowlist cost, impact line and Table's eager total carry the check's printout at this head, with the Button and Link rows rising to 19.5 and 21.6 KB. Verified: the check prints the same figures, with Table's context-menu row and eager total 0.1 and 0.4 KB apart, inside the record's allowance for local runs.
  • Claim: tests, typecheck, ESLint and the knowledge check pass. Verified: 45 files and 1,267 UI tests, 36 node tests, Core typecheck, ESLint with 0 errors, and the knowledge check.
  • File .changeset/text-tap-recognizer-first-load.md: clear.
  • File docs/architecture/component-import-boundaries.md: clear; owner-approved at this head, and its figures match the check.
  • File packages/core/src/Layer/gestureCounter.ts: the non-blocking header note above.
  • File packages/core/src/Layer/useTouchTrigger.ts: clear.
  • File packages/core/src/Text/TruncationTooltip.tsx: clear.
  • File scripts/check-component-import-boundaries.mjs: clear.
  • File scripts/check-component-import-boundaries.test.mjs: clear.

Automated review (maintainer link)

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 9f0436a

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 15, 2026

@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: the heavy CI suites have not finished on this head yet, and the merge guard waits for them.

The tap recognizer move keeps behavior identical, the import-boundary check holds with the re-targeted allowlist row, and a page with only Text and Heading loads about 9.6 KB less JavaScript (3.4 KB gzip) before first paint. Two optional follow-ups: the record's Table context-menu row, windowing row and Table eager total read 88.5, 3.6 and 134.5 KB where CI's check prints 88.7, 3.5 and 134.9 KB, and the description's per-page table was measured before main was merged in (its deltas still reproduce on this head). The open note on the gestureCounter.ts header length still applies.

Claims and files checked

Review mode: full; reason: spec-record

  • Changeset: a page whose components bring no tooltip code, such as Text and Heading only, loads about 9.6 KB less JavaScript before first paint (about 3.4 KB gzip): verified, 9,613 B less minified and 3,443 B less gzip on this head; CI's check prints Text 12.4 → 9.1 KB and Heading 12.9 → 9.5 KB.
  • Changeset: the truncation tooltip's tap handling no longer shares a file with the touch trigger, so that code stays with the lazily loaded tooltip: verified, TruncationTooltip.tsx:30 imports the gesture counter and the touch trigger leaves Text's first load.
  • Changeset: tapping a truncated text opens its tooltip as before: verified, the moved code is identical apart from two comments and the Text, Tooltip, HoverCard and Layer tests pass.
  • Title: Text's first load drops 9.6 KB: verified (9,613 B minified).
  • The recognizer needs only the gesture counter: verified, its one dependency is currentGesture.
  • On the base, the rest of the touch trigger, keyboard height, interaction modality and the clickable-container walk land in Text's first load: verified, the base check prices that crossing at 5.1 KB gzip.
  • Pages that also render a component with a tooltip keep the touch trigger and change by a few bytes: verified, +30 to +35 B minified on the four reference pages.
  • About 31 components import Tooltip or HoverCard statically: verified (32 folders, counting hooks, Layer and a type-only import in Text).
  • No behavior change, pure move, same tests: verified.
  • The four names move to the gesture counter, both importers follow, no new module and no public API: verified; the API generator lists no changed rows.
  • The boundary check counts the gesture counter as a touch module and the allowlist row moves with the recognizer with the same entries and invariants: verified (check-component-import-boundaries.mjs:132, record :217, test :395).
  • Alternatives measured and dropped: not part of this change; the one checkable premise holds (the clickable-container hook imports only cancelPress from press feedback).
  • The row change has the record owner's approval, and the moved Effect names what it syncs: verified.
  • Per-page first-load table: deltas verified on this head against its base (Text page −9,613 B; reference pages +30 to +35 B minified, +6 to +35 B gzip); the absolute columns predate the merges of main.
  • A Vite build agrees: consistent with the esbuild page builds; the Vite build itself was not rerun.
  • The boundary check prints Text 12.4 → 9.0 KB and Heading 12.8 → 9.5 KB with other entries unchanged: verified within a tenth (CI: 12.4 → 9.1, 12.9 → 9.5, others +0.0).
  • The record's figures carry the check's printout on this head: four of seven exact; three within 0.4 KB of CI's printout.
  • Android emulator tap on base and head: stated device evidence, accepted as stated.
  • Tests, typecheck, ESLint, the knowledge check and the boundary check pass: verified on this head.
  • .changeset/text-tap-recognizer-first-load.md: clear.
  • docs/architecture/component-import-boundaries.md: non-blocking note (three figures a few tenths off CI).
  • packages/core/src/Layer/gestureCounter.ts: non-blocking note (header length).
  • packages/core/src/Layer/useTouchTrigger.ts: clear.
  • packages/core/src/Text/TruncationTooltip.tsx: clear.
  • scripts/check-component-import-boundaries.mjs: clear.
  • scripts/check-component-import-boundaries.test.mjs: clear.

Automated review (maintainer link)

| `Text/TruncationTooltip` → `Layer/gestureCounter` | Text, Heading, Button, IconButton, Link, Table | 1.7 KB (Text, Heading) | INV1, INV8 | the truncation tooltip's eager code carries no touch tap recognizer; the row moves with the recognizer |
| `Button/Button` → `Tooltip/useTooltip` | Button, IconButton | 19.5 KB | INV1 | Button's tooltip layer code is lazy |
| `Link/Link` → `Tooltip` | Link | 21.6 KB | INV1 | Link's tooltip layer code is lazy |
| `Table/tableContextMenu` → `ContextMenu` | Table | 88.5 KB | INV1 | cells without actions reach no menu module |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: CI's boundary check on this head prints 88.7 KB for this row, 3.5 KB for the windowing row below, and 134.9 KB for Table's eager total (line 228). The record allows a few tenths for a local run, so this is within tolerance; pasting CI's figures (here and in the impact lines at 267 and 271) makes the cells exactly the printout that line 223 names.

@cixzhang
cixzhang marked this pull request as draft November 15, 2026 01:18
@cixzhang
cixzhang marked this pull request as ready for review November 15, 2026 01:18
@cixzhang
cixzhang merged commit 762a65d into main Nov 15, 2026
154 of 158 checks passed
@github-actions
github-actions Bot deleted the perf/tap-recognizer-gesture-counter branch November 15, 2026 06:03

This branch was successfully deployed

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant