Repository navigation
perf(core): skip the kebab-case regex for lowercase theme prop names - #12088
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks for the speed-up: the cache and the for…in loop keep themeProps output identical and cut the per-call cost several times over. One small change is needed before this can be approved.
- The new test
caches computed data attribute names across repeated lookups(packages/core/src/utils/themeProps.test.ts:67-72) cannot fail when the cache is removed, becausetoBeon two equal strings passes either way and the file passes against the currentmainimplementation, which has no cache; rename it to what it checks (for examplekebab-cases multi-word prop names) and drop thesecondassertion, or remove it, since the existing output tests already cover the contract.
Optional: for…in also visits inherited enumerable keys, so themeDataAttributes(Object.create({variant: 'x'})) now returns data-variant where main returns nothing, and an Object.hasOwn(props, prop) guard keeps the old result. CI has not run on this head yet; a maintainer adds the ci:run label so it runs.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the changeset says attribute names are cached and props are walked with
for…into avoid repeated regular-expression work and entries arrays: verified (themeProps.ts:10-19,:66-71). - Claim: the old name helper ran a regular expression and lowercasing on every call: verified (
themeProps.ts:10-12onmain). - Claim: the old loop allocated an entries array: verified (
themeProps.ts:59onmain). - Claim: a module-level
Mapcaches computed names: verified (themeProps.ts:10-19). - Claim: the loop now uses
for…in: verified (themeProps.ts:66-71). - Claim: the unit test file passes: verified (9 tests pass).
- Claim: the core typecheck passes: verified.
- Claim: fixes #12061, each name computed once per prop name: verified; one call over the issue's inputs drops from about 1,100 ns to about 175 ns with identical output.
- File
.changeset/theme-props-attribute-cache.md: clear. - File
packages/core/src/utils/themeProps.ts: clear, with the optional note above. - File
packages/core/src/utils/themeProps.test.ts: the finding above.
|
Updated. Added |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, and a maintainer adds the ci:run label so it runs.
Both points from the last review are addressed: the test that could not fail is gone, and the Object.hasOwn guard keeps themeDataAttributes to own keys, with omits inherited properties failing if the guard is removed. Reflected names and every built theme are unchanged, and one themeProps call is several times faster.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim: the changeset says attribute names are cached and props are walked with
for…in, avoiding repeated regular-expression work and entries arrays during render: verified (themeProps.ts:10-19,:66-74). - Claim: the name helper used to run a regular expression and lowercasing on every call: verified (
themeProps.ts:10-12onmain). - Claim: the loop used to allocate an entries array: verified (
themeProps.ts:59onmain). - Claim: a module-level
Mapcaches computed names: verified (themeProps.ts:10-19). - Claim: the loop now uses
for…in: verified (themeProps.ts:66-74). - Claim: the unit test file passes: verified (9 tests pass).
- Claim: the Core typecheck passes: verified.
- Claim: fixes #12061, each name computed once per prop name: verified; one call over the issue's inputs drops from about 780 ns to about 145 ns with identical output.
- File
.changeset/theme-props-attribute-cache.md: clear. - File
packages/core/src/utils/themeProps.ts: clear. - File
packages/core/src/utils/themeProps.test.ts: clear; the new test fails when the own-key guard is removed.
|
/approve-spec 47ee44a |
|
/approve-spec 18425e2 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The ci:run label is already applied, and the CI runs for this head are waiting for a maintainer to approve them.
The own-keys guard keeps themeDataAttributes returning exactly what main returns, omits inherited properties fails if the guard is removed, and reflected names and every built theme are unchanged. One themeProps call is a little over twice as fast on the built package, for 17–53 bytes of gzip per page.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim: the changeset says attribute names are cached and props are walked with
for…in, avoiding repeated regular-expression work and entries arrays during render: verified (themeProps.ts:10-19,:62-78). - Claim: the name helper used to run a regular expression and lowercasing on every call: verified (
themeProps.ts:10-12onmain). - Claim: the loop used to allocate an entries array: verified (
themeProps.ts:59onmain). - Claim: a module-level
Mapcaches computed names: verified (themeProps.ts:10-19). - Claim: the loop now uses
for…in: verified (themeProps.ts:66-74). - Claim: the unit test file passes: verified (9 tests pass, alongside the theming suites).
- Claim: the Core typecheck passes: verified.
- Claim: fixes #12061, each name computed once per prop name: verified; one call over the issue's inputs drops from about 1,600 ns to about 690 ns with identical output.
- File
.changeset/theme-props-attribute-cache.md: clear. - File
packages/core/src/utils/themeProps.ts: clear. - File
packages/core/src/utils/themeProps.test.ts: clear; the new test fails when the own-key guard is removed.
|
/approve-spec 1112c76 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The ci:run label is already applied, and the CI runs for this head are waiting for a maintainer to approve them.
This head only merges main, which touches none of the changed files, so the earlier approval carries forward: the own-keys guard keeps themeDataAttributes returning exactly what main returns, omits inherited properties fails if the guard is removed, and reflected names and every built theme are unchanged.
Claims and files checked
Review mode: carry-forward; reason: none
- Claim: the changeset says attribute names are cached and props are walked with
for…in, avoiding repeated regular-expression work and entries arrays during render: verified (themeProps.ts:10-19,:66-74). - Claim: the name helper used to run a regular expression and lowercasing on every call: verified (
themeProps.ts:10-12onmain). - Claim: the loop used to allocate an entries array: verified (
themeProps.ts:59onmain). - Claim: a module-level
Mapcaches computed names: verified (themeProps.ts:10-19). - Claim: the loop now uses
for…in: verified (themeProps.ts:66-74). - Claim: the unit test file passes: verified on the identical patch before this merge (9 tests pass); the module, the test and its one import are unchanged since.
- Claim: the Core typecheck passes: verified on the identical patch before this merge.
- Claim: fixes #12061, each name computed once per prop name: verified; one call over the issue's inputs drops from about 1,600 ns to about 690 ns with identical output.
- File
.changeset/theme-props-attribute-cache.md: clear. - File
packages/core/src/utils/themeProps.ts: clear. - File
packages/core/src/utils/themeProps.test.ts: clear; the new test fails when the own-key guard is removed.
|
/approve-spec 5ce33ab |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The pull request is still a draft, which runs no CI; the ci:run label is already applied, and this head's CI runs are waiting for a maintainer to approve them.
This head merges main, which touches none of the changed files. The own-keys guard keeps themeDataAttributes returning exactly what main returns, omits inherited properties fails if the guard is removed, and reflected names and every built theme are unchanged.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim: the changeset says attribute names are cached and props are walked with
for…in, avoiding repeated regular-expression work and entries arrays during render: verified (themeProps.ts:10-19,:62-78). - Claim: the name helper used to run a regular expression and lowercasing on every call: verified (
themeProps.ts:10-12onmain). - Claim: the loop used to allocate an entries array: verified (
themeProps.ts:59onmain). - Claim: a module-level
Mapcaches computed names: verified (themeProps.ts:10-19). - Claim: the loop now uses
for…in: verified (themeProps.ts:66-74). - Claim: the unit test file passes: verified (9 tests pass).
- Claim: the Core typecheck passes: verified.
- Claim: fixes #12061, each name computed once per prop name: verified; one call over the issue's inputs drops from about 880 ns to about 205 ns with identical output.
- File
.changeset/theme-props-attribute-cache.md: clear. - File
packages/core/src/utils/themeProps.ts: clear. - File
packages/core/src/utils/themeProps.test.ts: clear; the new test fails when the own-key guard is removed.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC |
|---|---|---|
| ListItem | 81.5 kB (+109 B) · 12.6 kB CSS (0) | — |
| Field | 61.4 kB (+96 B) · 7.6 kB CSS (0) | — |
| TextArea | 95.0 kB (+95 B) · 10.0 kB CSS (0) | — |
223 more components
| Component | Size | LoC |
|---|---|---|
| RadioList | 62.9 kB (+94 B) · 7.7 kB CSS (0) | — |
| CheckboxInput | 71.4 kB (+92 B) · 10.6 kB CSS (0) | — |
| DropdownMenu | 113.2 kB (+91 B) · 19.8 kB CSS (0) | — |
| InputGroup | 63.6 kB (+91 B) · 8.9 kB CSS (0) | — |
| MoreMenu | 113.4 kB (+91 B) · 19.8 kB CSS (0) | — |
| Slider | 116.6 kB (+90 B) · 9.2 kB CSS (0) | — |
| lab/EmojiPicker | 120.9 kB (+89 B) · 751 B CSS (0) | — |
| MobileNavToggle | 67.6 kB (+88 B) · 11.1 kB CSS (0) | — |
| TextInput | 101.3 kB (+88 B) · 12.8 kB CSS (0) | — |
| TimeInput | 180.4 kB (+88 B) · 17.9 kB CSS (0) | — |
| lab/SelectableCardGroup | 71.8 kB (+87 B) · 162 B CSS (0) | — |
| charts/ChartLegend | 41.9 kB (+86 B) · 224 B CSS (0) | — |
| ChatSendButton | 67.7 kB (+86 B) · 11.1 kB CSS (0) | — |
| FileInput | 77.5 kB (+86 B) · 12.8 kB CSS (0) | — |
| Lightbox | 150.9 kB (+86 B) · 12.3 kB CSS (0) | — |
| ChatDictationButton | 67.9 kB (+85 B) · 11.2 kB CSS (0) | — |
| lab/TransferList | 139.5 kB (+85 B) · 1.2 kB CSS (0) | — |
| CheckboxList | 75.5 kB (+84 B) · 8.1 kB CSS (0) | — |
| NumberInput | 106.3 kB (+84 B) · 13.1 kB CSS (0) | — |
| Pagination | 153.2 kB (+84 B) · 20.1 kB CSS (0) | — |
| RadioListItem | 78.4 kB (+84 B) · 11.2 kB CSS (0) | — |
| SideNav | 124.2 kB (+84 B) · 12.5 kB CSS (0) | — |
| TableCell | 106.2 kB (+84 B) · 20.2 kB CSS (0) | — |
| TableSelectionToolbar | 77.8 kB (+84 B) · 14.5 kB CSS (0) | — |
| TopNavMenu | 87.0 kB (+84 B) · 12.4 kB CSS (0) | — |
| lab/AudioPlayer | 233.5 kB (+84 B) · 1.8 kB CSS (0) | — |
| lab/CommentComposer | 185.5 kB (+84 B) · 1.9 kB CSS (0) | — |
| richtext/RichTextEditor | 310.8 kB (+84 B) · 2.7 kB CSS (0) | — |
| Button | 67.3 kB (+83 B) · 11.1 kB CSS (0) | — |
| ChatLayoutScrollButton | 67.9 kB (+83 B) · 11.3 kB CSS (0) | — |
| ComplexSelector | 83.8 kB (+83 B) · 13.2 kB CSS (0) | — |
| IconButton | 67.3 kB (+83 B) · 11.1 kB CSS (0) | — |
| ToggleButton | 94.6 kB (+83 B) · 11.3 kB CSS (0) | — |
| lab/TransferListSelector | 151.4 kB (+83 B) · 1.4 kB CSS (0) | — |
| Banner | 69.4 kB (+82 B) · 11.6 kB CSS (0) | — |
| BottomSheet | 75.4 kB (+82 B) · 7.8 kB CSS (0) | — |
| ContextMenuItem | 38.7 kB (+82 B) · 7.3 kB CSS (0) | — |
| DialogHeader | 70.6 kB (+82 B) · 12.8 kB CSS (0) | — |
| DrawerHeader | 70.7 kB (+82 B) · 14.3 kB CSS (0) | — |
| Section | 7.9 kB (+82 B) · 6.4 kB CSS (0) | — |
| SideNavCollapseButton | 68.2 kB (+82 B) · 11.2 kB CSS (0) | — |
| SideNavHeading | 87.9 kB (+82 B) · 12.5 kB CSS (0) | — |
| lab/ListInput | 97.2 kB (+82 B) · 922 B CSS (0) | — |
| lab/MediaFullscreenButton | 223.4 kB (+82 B) · 1.5 kB CSS (0) | — |
| lab/Schedule | 117.6 kB (+82 B) · 3.9 kB CSS (0) | — |
| Calendar | 78.5 kB (+81 B) · 11.8 kB CSS (0) | — |
| Center | 4.5 kB (+81 B) · 4.6 kB CSS (0) | — |
| CheckboxListItem | 82.4 kB (+81 B) · 12.6 kB CSS (0) | — |
| FieldLabel | 57.2 kB (+81 B) · 6.1 kB CSS (0) | — |
| InfoTip | 52.0 kB (+81 B) · 5.7 kB CSS (0) | — |
| TableHeaderCell | 106.1 kB (+81 B) · 20.0 kB CSS (0) | — |
| TopNavMegaMenu | 81.5 kB (+81 B) · 13.0 kB CSS (0) | — |
| lab/MediaSeekButton | 223.4 kB (+81 B) · 1.5 kB CSS (0) | — |
| richtext/RichTextView | 287.4 kB (+81 B) · 2.4 kB CSS (0) | — |
| charts/ChartTooltip | 224.8 kB (+80 B) · 451 B CSS (0) | — |
| ContextMenu | 105.0 kB (+80 B) · 19.6 kB CSS (0) | — |
| Thumbnail | 71.8 kB (+80 B) · 12.7 kB CSS (0) | — |
| Typeahead | 94.8 kB (+80 B) · 14.4 kB CSS (0) | — |
| lab/ChatUnreadDivider | 3.8 kB (+80 B) · 348 B CSS (0) | — |
| lab/MediaPlaybackRate | 223.4 kB (+80 B) · 1.5 kB CSS (0) | — |
| lab/MediaPlayButton | 223.4 kB (+80 B) · 1.5 kB CSS (0) | — |
| lab/MediaTime | 223.4 kB (+80 B) · 1.5 kB CSS (0) | — |
| lab/MediaTimeSlider | 223.4 kB (+80 B) · 1.5 kB CSS (0) | — |
| lab/MediaVolume | 223.4 kB (+80 B) · 1.5 kB CSS (0) | — |
| lab/TabBarMoreList | 104.7 kB (+80 B) · 1.8 kB CSS (0) | — |
| BaseTypeahead | 83.7 kB (+79 B) · 12.1 kB CSS (0) | — |
| ChatLayout | 91.0 kB (+79 B) · 11.7 kB CSS (0) | — |
| ChatToolCalls | 32.8 kB (+79 B) · 8.8 kB CSS (0) | — |
| CommandPaletteInput | 34.1 kB (+79 B) · 7.9 kB CSS (0) | — |
| DropdownMenuRadioItem | 29.5 kB (+79 B) · 7.6 kB CSS (0) | — |
| HoverCard | 31.1 kB (+79 B) · 4.8 kB CSS (0) | — |
| MultiSelector | 108.9 kB (+79 B) · 18.9 kB CSS (0) | — |
| Skeleton | 4.1 kB (+79 B) · 3.8 kB CSS (0) | — |
| Token | 30.2 kB (+79 B) · 5.0 kB CSS (0) | — |
| TopNavHeading | 87.6 kB (+79 B) · 12.4 kB CSS (0) | — |
| lab/MediaCaptionsButton | 223.4 kB (+79 B) · 1.5 kB CSS (0) | — |
| Drawer | 57.3 kB (+78 B) · 8.7 kB CSS (0) | — |
| SelectorOption | 24.7 kB (+78 B) · 6.8 kB CSS (0) | — |
| lab/CircleCheckIndicator | 4.6 kB (+78 B) · 1.0 kB CSS (0) | — |
| lab/DiffViewer | 95.6 kB (+78 B) · 2.1 kB CSS (0) | — |
| lab/Stat | 4.4 kB (+78 B) · 646 B CSS (0) | — |
| ChatComposerInput | 87.7 kB (+77 B) · 12.5 kB CSS (0) | — |
| ChatComposerTokenElement | 87.7 kB (+77 B) · 12.5 kB CSS (0) | — |
| CheckboxIndicator | 2.8 kB (+77 B) · 849 B CSS (0) | — |
| GridSpan | 3.7 kB (+77 B) · 3.4 kB CSS (0) | — |
| NavIcon | 3.7 kB (+77 B) · 3.4 kB CSS (0) | — |
| CodeBlock | 83.4 kB (+76 B) · 12.9 kB CSS (0) | — |
| CommandPalette | 82.7 kB (+76 B) · 13.5 kB CSS (0) | — |
| CommandPaletteGroup | 3.8 kB (+76 B) · 3.5 kB CSS (0) | — |
| DateRangeInput | 106.2 kB (+76 B) · 14.2 kB CSS (0) | — |
| Grid | 4.6 kB (+76 B) · 3.8 kB CSS (0) | — |
| Link | 57.9 kB (+76 B) · 7.4 kB CSS (0) | — |
| Selector | 120.2 kB (+76 B) · 19.7 kB CSS (0) | — |
| Table | 124.0 kB (+76 B) · 21.1 kB CSS (0) | — |
| Timestamp | 27.7 kB (+76 B) · 11.4 kB CSS (0) | — |
| TopNav | 80.7 kB (+76 B) · 12.1 kB CSS (0) | — |
| lab/Comments | 388.4 kB (+76 B) · 2.5 kB CSS (0) | — |
| richtext/RichTextEditorToolbar | 315.2 kB (+76 B) · 454 B CSS (0) | — |
| Blockquote | 3.8 kB (+75 B) · 3.5 kB CSS (0) | — |
| ChatSystemMessage | 7.2 kB (+75 B) · 3.8 kB CSS (0) | — |
| Icon | 8.7 kB (+75 B) · 681 B CSS (0) | — |
| MobileNav | 78.8 kB (+75 B) · 11.8 kB CSS (0) | — |
| RadioIndicator | 2.6 kB (+75 B) · 831 B CSS (0) | — |
| SegmentedControlItem | 19.3 kB (+75 B) · 4.3 kB CSS (0) | — |
| Stepper | 69.1 kB (+75 B) · 11.3 kB CSS (0) | — |
| lab/ChatReasoning | 7.3 kB (+75 B) · 967 B CSS (0) | — |
| AspectRatio | 4.0 kB (+74 B) · 3.6 kB CSS (0) | — |
| ButtonGroup | 44.8 kB (+74 B) · 3.7 kB CSS (0) | — |
| Code | 3.8 kB (+74 B) · 3.5 kB CSS (0) | — |
| HStack | 6.1 kB (+74 B) · 1.6 kB CSS (0) | — |
| PowerSearch | 318.4 kB (+74 B) · 27.3 kB CSS (0) | — |
| SideNavItem | 82.2 kB (+74 B) · 12.3 kB CSS (0) | — |
| Stack | 5.9 kB (+74 B) · 1.6 kB CSS (0) | — |
| StatusDot | 34.7 kB (+74 B) · 5.7 kB CSS (0) | — |
| Switch | 111.5 kB (+74 B) · 10.5 kB CSS (0) | — |
| TableFooter | 3.6 kB (+74 B) · 3.3 kB CSS (0) | — |
| TabMenu | 84.1 kB (+74 B) · 12.3 kB CSS (0) | — |
| TreeList | 47.4 kB (+74 B) · 6.0 kB CSS (0) | — |
| VStack | 6.1 kB (+74 B) · 1.6 kB CSS (0) | — |
| lab/ChatEmojiPicker | 127.8 kB (+74 B) · 773 B CSS (0) | — |
| lab/ChatReactionBar | 129.0 kB (+74 B) · 1.1 kB CSS (0) | — |
| lab/DialogHeroHeader | 91.9 kB (+74 B) · 372 B CSS (0) | — |
| ChatComposer | 90.5 kB (+73 B) · 13.5 kB CSS (0) | — |
| ChatMessageList | 28.4 kB (+73 B) · 7.4 kB CSS (0) | — |
| Divider | 5.3 kB (+73 B) · 535 B CSS (0) | — |
| DropdownMenuGroup | 6.5 kB (+73 B) · 3.4 kB CSS (0) | — |
| Item | 20.9 kB (+73 B) · 6.2 kB CSS (0) | — |
| NavHeadingMenuItem | 16.8 kB (+73 B) · 6.7 kB CSS (0) | — |
| Overlay | 23.9 kB (+73 B) · 4.1 kB CSS (0) | — |
| TableHeader | 3.6 kB (+73 B) · 3.3 kB CSS (0) | — |
| Toast | 107.1 kB (+73 B) · 11.5 kB CSS (0) | — |
| Tokenizer | 112.7 kB (+73 B) · 21.9 kB CSS (0) | — |
| lab/CommentThread | 381.5 kB (+73 B) · 2.4 kB CSS (0) | — |
| AppShell | 101.2 kB (+72 B) · 14.9 kB CSS (0) | — |
| Carousel | 77.4 kB (+72 B) · 12.1 kB CSS (0) | — |
| CheckIndicator | 8.9 kB (+72 B) · 681 B CSS (0) | — |
| CommandPaletteItem | 13.7 kB (+72 B) · 3.6 kB CSS (0) | — |
| DropdownMenuDivider | 5.4 kB (+72 B) · 548 B CSS (0) | — |
| ToggleButtonGroup | 42.1 kB (+72 B) · 3.7 kB CSS (0) | — |
| lab/LineClamp | 13.9 kB (+72 B) · 168 B CSS (0) | — |
| DateInput | 208.2 kB (+71 B) · 18.9 kB CSS (0) | — |
| DropdownMenuCheckboxItem | 29.4 kB (+71 B) · 7.6 kB CSS (0) | — |
| TopNavItem | 14.7 kB (+71 B) · 4.0 kB CSS (0) | — |
| TypeaheadItem | 6.6 kB (+71 B) · 3.6 kB CSS (0) | — |
| ProgressBar | 12.4 kB (+70 B) · 6.7 kB CSS (0) | — |
| lab/LogStream | 8.3 kB (+70 B) · 1.6 kB CSS (0) | — |
| Badge | 7.3 kB (+69 B) · 4.1 kB CSS (0) | — |
| Card | 10.4 kB (+69 B) · 7.0 kB CSS (0) | — |
| ChatMessageBubble | 7.6 kB (+69 B) · 3.8 kB CSS (0) | — |
| ChatTokenizedText | 7.6 kB (+69 B) · 4.1 kB CSS (0) | — |
| Collapsible | 30.0 kB (+69 B) · 4.5 kB CSS (0) | — |
| DateTimeInput | 232.1 kB (+69 B) · 20.6 kB CSS (0) | — |
| FormLayout | 7.0 kB (+69 B) · 3.5 kB CSS (0) | — |
| Markdown | 208.8 kB (+69 B) · 23.4 kB CSS (0) | — |
| NavHeadingMenu | 18.9 kB (+69 B) · 3.5 kB CSS (0) | — |
| Step | 32.3 kB (+69 B) · 5.7 kB CSS (0) | — |
| TableRow | 7.3 kB (+69 B) · 4.1 kB CSS (0) | — |
| TabList | 48.5 kB (+69 B) · 6.8 kB CSS (0) | — |
| lab/CodeEditor | 14.6 kB (+69 B) · 743 B CSS (0) | — |
| BreadcrumbItem | 102.3 kB (+68 B) · 14.0 kB CSS (0) | — |
| CommandPaletteEmpty | 6.5 kB (+68 B) · 3.5 kB CSS (0) | — |
| CommandPaletteList | 16.6 kB (+68 B) · 3.4 kB CSS (0) | — |
| EmptyState | 7.1 kB (+68 B) · 510 B CSS (0) | — |
| FieldStatus | 10.8 kB (+68 B) · 3.7 kB CSS (0) | — |
| InputGroupText | 7.0 kB (+68 B) · 3.9 kB CSS (0) | — |
| Tab | 15.1 kB (+68 B) · 4.3 kB CSS (0) | — |
| Tooltip | 33.1 kB (+68 B) · 4.8 kB CSS (0) | — |
| lab/MediaPlayerElement | 6.9 kB (+68 B) · 177 B CSS (0) | — |
| lab/SVGIcon | 8.0 kB (+68 B) · 765 B CSS (0) | — |
| ClickableCard | 19.4 kB (+67 B) · 7.9 kB CSS (0) | — |
| LayoutHeader | 6.5 kB (+67 B) · 1.7 kB CSS (0) | — |
| List | 19.5 kB (+67 B) · 810 B CSS (0) | — |
| MetadataListItem | 7.1 kB (+67 B) · 3.6 kB CSS (0) | — |
| SideNavSection | 7.1 kB (+67 B) · 3.7 kB CSS (0) | — |
| lab/VideoPlayer | 231.1 kB (+67 B) · 2.1 kB CSS (0) | — |
| lab/WeightedSVGIcon | 5.1 kB (+67 B) · 1.1 kB CSS (0) | — |
| Avatar | 46.9 kB (+66 B) · 6.0 kB CSS (0) | — |
| CommandPaletteFooter | 17.7 kB (+66 B) · 3.7 kB CSS (0) | — |
| Dialog | 27.8 kB (+66 B) · 7.3 kB CSS (0) | — |
| Kbd | 17.3 kB (+66 B) · 3.6 kB CSS (0) | — |
| Popover | 104.0 kB (+66 B) · 15.5 kB CSS (0) | — |
| TableBody | 6.7 kB (+66 B) · 3.3 kB CSS (0) | — |
| lab/TourStep | 96.5 kB (+66 B) · 691 B CSS (0) | — |
| AvatarStatusDot | 7.7 kB (+65 B) · 3.6 kB CSS (0) | — |
| DropdownMenuItem | 28.6 kB (+65 B) · 7.1 kB CSS (0) | — |
| Layout | 7.2 kB (+65 B) · 2.3 kB CSS (0) | — |
| LayoutFooter | 6.4 kB (+65 B) · 1.7 kB CSS (0) | — |
| Timer | 13.8 kB (+65 B) · 6.4 kB CSS (0) | — |
| AlertDialog | 132.9 kB (+64 B) · 16.2 kB CSS (0) | — |
| CollapsibleGroup | 7.0 kB (+64 B) · 3.3 kB CSS (0) | — |
| ScrollableArea | 11.5 kB (+64 B) · 4.4 kB CSS (0) | — |
| lab/NavigationStack | 86.4 kB (+64 B) · 1.5 kB CSS (0) | — |
| charts/Chart | 248.3 kB (+63 B) · 516 B CSS (0) | — |
| Outline | 26.8 kB (+63 B) · 4.2 kB CSS (0) | — |
| ResizeHandle | 22.4 kB (+63 B) · 4.3 kB CSS (0) | — |
| SelectableCard | 19.6 kB (+63 B) · 8.1 kB CSS (0) | — |
| lab/CircularProgress | 9.1 kB (+63 B) · 859 B CSS (0) | — |
| lab/NavigationScreen | 86.4 kB (+63 B) · 1.5 kB CSS (0) | — |
| AvatarGroup | 49.7 kB (+62 B) · 6.1 kB CSS (0) | — |
| DropdownMenuSubMenu | 80.4 kB (+62 B) · 11.0 kB CSS (0) | — |
| Toolbar | 48.2 kB (+62 B) · 8.6 kB CSS (0) | — |
| Heading | 12.2 kB (+61 B) · 5.8 kB CSS (0) | — |
| OverflowList | 12.7 kB (+61 B) · 3.7 kB CSS (0) | — |
| Text | 11.4 kB (+61 B) · 5.8 kB CSS (0) | — |
| TopNavMegaMenuItem | 15.4 kB (+61 B) · 4.2 kB CSS (0) | — |
| TopNavMegaMenuFeaturedCard | 8.5 kB (+60 B) · 3.6 kB CSS (0) | — |
| Citation | 21.3 kB (+59 B) · 4.5 kB CSS (0) | — |
| AvatarGroupOverflow | 52.9 kB (+57 B) · 6.0 kB CSS (0) | — |
| Spinner | 25.0 kB (+57 B) · 6.6 kB CSS (0) | — |
| lab/CommentPin | 61.7 kB (+57 B) · 1.2 kB CSS (0) | — |
| ChatComposerDrawer | 18.5 kB (+56 B) · 4.8 kB CSS (0) | — |
| LayoutPanel | 22.3 kB (+55 B) · 5.1 kB CSS (0) | — |
| Breadcrumbs | 16.6 kB (+54 B) · 3.4 kB CSS (0) | — |
| ChatMessageMetadata | 20.9 kB (+54 B) · 4.2 kB CSS (0) | — |
| lab/TabBar | 84.5 kB (+53 B) · 1.8 kB CSS (0) | — |
| LayoutContent | 18.1 kB (+52 B) · 1.8 kB CSS (0) | — |
| SegmentedControl | 103.5 kB (+52 B) · 7.2 kB CSS (0) | — |
| ChatMessage | 17.3 kB (+51 B) · 3.7 kB CSS (0) | — |
| lab/ChatTypingIndicator | 26.5 kB (+50 B) · 612 B CSS (0) | — |
| lab/MediaPlayer | 31.3 kB (+50 B) · 165 B CSS (0) | — |
| StackItem | 16.7 kB (+49 B) · 219 B CSS (0) | — |
| MetadataList | 17.4 kB (+45 B) · 3.8 kB CSS (0) | — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — |
Package size: @astryxdesign/core 7.96 MB packed (+539 B); no new dependencies.
Not run on this PR: add ci:run-visual for Visual, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
A module-level Map is cross-module identity in module scope and mutable state in a server-safe module graph. Keep the for...in loop, which avoids the entries array, and compute each name directly.
Most visual prop names have no uppercase letter, so their attribute name is the name itself. This keeps the per-render saving without module state.
|
/approve-spec 0e6f8e2 |
|
/approve-spec cc85601 |
There was a problem hiding this comment.
Changes requested: one output change in the new fast path is still open at this head.
hasUppercase(packages/core/src/utils/themeProps.ts:18-26) finds only ASCIIA–Z, so a prop name whose only capital is non-ASCII now keeps it (themeDataAttributes({Ölstand: 'x'})returnsdata-Ölstandwheremainreturnsdata-ölstand), which changes the output of the exportedthemeProps,themeDataAttributesandparseStyleKeyand makes the description's "every result is unchanged" untrue: send code units above 127 to the regex path with(code >= 65 && code <= 90) || code > 127, rename the helper to what it checks, and add a test that pins{Ölstand: 'x'}todata-ölstand.
Everything else holds: the Object.hasOwn guard keeps the own-keys-only result, Core's own attributes and theme CSS are unchanged, and the fast path roughly halves the per-call cost on the issue's inputs.
Claims and files checked
Review mode: same-head; reason: none
- Changeset: lowercase prop names skip the regular expression and
for...inreplaces theObject.entriesarray: verified (themeProps.ts:11-13,:72-81). - Description: the old code ran the regex and lowercasing on every call and allocated an entries array: verified (
themeProps.ts:10-11and:59onmain). - Description: a name with no uppercase letter returns directly: true only for ASCII capitals (
themeProps.ts:18-26). - Description: camelCase names still take the regex, so every result is unchanged: false for names whose only capitals are non-ASCII.
- Description:
for...inwith an own-property check: verified (themeProps.ts:73-76; the inherited-properties test fails without the guard). - Description: no module-scope state, keeping the saving for common names: verified (no module state; about 1,120 ns to 530 ns per call on the issue's inputs).
- Description: the test file and the Core typecheck pass: verified.
.changeset/theme-props-lowercase-fast-path.md: clear.packages/core/src/utils/themeProps.test.ts: clear.packages/core/src/utils/themeProps.ts: one blocking finding, above.
A non-ASCII capital has a lowercase form, so only lowercase ASCII names take the fast path. Every attribute name now matches main.
|
/approve-spec 01f8827 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The pull request is still a draft, which runs no CI; the ci:run label is already applied, so marking it ready for review starts CI at this head.
The non-ASCII fix holds: attribute names now match main for every input, Ölstand is pinned to data-ölstand, and the fast path still roughly halves the per-call cost on the issue's inputs. One optional comment-wording suggestion is inline.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Changeset: lowercase prop names skip the attribute-name regular expression: verified (
themeProps.ts:11-13,:19-27; every lowercase name Core passes is ASCII, and a non-ASCII name takes the regular expression with the same result). - Changeset: the attribute helper iterates with
for...ininstead of allocating an entries array: verified (themeProps.ts:74-82). - Description: the old helper ran the regular expression and lowercasing for every name and allocated an entries array: verified (
themeProps.ts:11and:59onmain). - Description: lowercase ASCII names such as
variant,sizeandpaddingreturn directly: verified (themeProps.ts:11-13,:22). - Description: camelCase names and names with a non-ASCII character still take the regular expression, so every result is unchanged: verified (no difference from
mainover every single code unit and 300,000 random names;themeProps.test.ts:63-65). - Description:
for...inwith an own-property check: verified (themeProps.ts:74-77;omits inherited propertiesfails without the guard). - Description: the earlier module-level cache failed the server-safety and shared-identity checks, and this version keeps no module state: verified (both checks fail with the cache and pass at this head).
- Description: the test file and the Core typecheck pass: verified.
.changeset/theme-props-lowercase-fast-path.md: clear.packages/core/src/utils/themeProps.test.ts: clear.packages/core/src/utils/themeProps.ts: one non-blocking comment-wording suggestion (inline).
|
/approve-spec b72e9bb |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The pull request is still a draft, and GitHub is holding this head's workflow runs for a maintainer's approval; the ci:run label is already applied, so once it is marked ready for review and the runs are approved, CI runs at this head.
Attribute names match main for every input checked, non-ASCII names and inherited keys included, and the lowercase fast path roughly halves the cost of a themeDataAttributes call on typical props. No changes are needed.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Changeset: lowercase prop names skip the attribute-name regular expression: verified (
themeProps.ts:10-13,:20-28). - Changeset: the attribute helper iterates with
for...ininstead of allocating an entries array on each render: verified (themeProps.ts:75-83). - Description: the old helper ran the regular expression and lowercasing for every name on every render and allocated an entries array: verified (base
themeProps.ts:10-12,:59-64). - Description: lowercase ASCII names such as
variant,sizeandpaddingreturndata-<name>directly: verified (themeProps.ts:11-13). - Description: camelCase names and names with a non-ASCII character still take the regular expression, so every result is unchanged: verified (no difference from
mainover every single code unit, alone and beside a letter, and 200,000 random names;themeProps.test.ts:63-65). - Description:
for...inwith an own-property check replacesObject.entries: verified (themeProps.ts:75-78;omits inherited propertiesfails without the guard). - Description: the first version's module-level cache failed the server/client boundary and shared-identity checks, and this version keeps no module state: verified (both checks fail on the cached version and pass at this head).
- Description: the test file and the Core typecheck pass: verified.
- Description: addresses the linked issue's per-render cost: verified for lowercase names; camelCase names such as
listStylestill take the regular expression, as the description says. .changeset/theme-props-lowercase-fast-path.md: clear.packages/core/src/utils/themeProps.test.ts: clear.packages/core/src/utils/themeProps.ts: clear.
|
(Posted by Cindy's agent.) Merged, thank you @TbhVishal! Theme props now skip the regular expression for lowercase names, so every themed render does a little less work. It ships in the next release, with you credited. |
Fixes #12061
In
themeProps.ts,themeDataAttributeNameran regex replacement and string lowercasing on every render for every visual prop name, andthemeDataAttributesallocated entries arrays viaObject.entries.themeDataAttributeNamenow returnsdata-<name>directly when the prop name is lowercase ASCII, which is most visual props (variant,size,padding); camelCase names such aslistStyleand any name with a non-ASCII character still go through the regular expression and lowercasing, so every result is unchanged.themeDataAttributesiterates withfor...inand an own-property check instead of allocating anObject.entriesarray.(Maintainer edit, posted by Cindy's agent: the first version cached names in a module-level
Map. Core keeps no module-scope mutable state in its server-safe module graph or as cross-module identity, and CI's RSC boundary and shared-identity checks failed on it. The lowercase fast path keeps the saving for the common case without module state. Original attribution is kept.)Tested locally with:
pnpm exec vitest run packages/core/src/utils/themeProps.test.tspnpm -F @astryxdesign/core typecheck