Repository navigation
[progress][meter][toggle group] Reduce bundle size - #5224
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,581.51 ms +154.36 ms(+10.8%) | Renders: 78 (+0) | Paint: 2,485.72 ms +252.29 ms(+11.3%)
…and 1 more (+8 within noise) — details Metric alarms
…and 2 more metric alarms — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
3a4dc65 to
9d21444
Compare
There was a problem hiding this comment.
Pull request overview
This PR reduces bundle size across ToggleGroup, Progress, and Meter by removing redundant context fields and eliminating bespoke state→data-attribute mapping where the default state attribute behavior already suffices, while adding targeted regression tests for the preserved public data-* attributes.
Changes:
- ToggleGroup: remove unused context fields and drop custom
data-multiplemapping in favor of the default state-attributes behavior. - Progress/Meter: remove redundant context fields and simplify Progress status attribute mapping to a compact
data-${status}form. - Add regression tests to ensure
data-multipleand Progress statusdata-*attributes behave as expected.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/toggle-group/ToggleGroupContext.ts | Removes unused orientation from context and simplifies the context hook to a direct useContext call. |
| packages/react/src/toggle-group/ToggleGroup.tsx | Removes redundant memoization and drops custom state-attribute mapping to reduce overhead. |
| packages/react/src/toggle-group/ToggleGroup.test.tsx | Adds coverage verifying data-multiple is only present when multiple={true}. |
| packages/react/src/progress/root/stateAttributesMapping.ts | Simplifies status→data attribute mapping to data-${status}. |
| packages/react/src/progress/root/ProgressRootContext.tsx | Removes redundant min/max/status fields from context (state already contains status). |
| packages/react/src/progress/root/ProgressRoot.tsx | Updates context value accordingly while keeping public ARIA/state behavior intact. |
| packages/react/src/progress/root/ProgressRoot.test.tsx | Adds regression coverage for status-driven data-* attributes. |
| packages/react/src/meter/root/MeterRootContext.ts | Removes redundant min/max fields from context. |
| packages/react/src/meter/root/MeterRoot.tsx | Updates context value accordingly without changing public ARIA behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4dbba4a to
a008788
Compare
Removes redundant internal context data and state-attribute mapping code from Progress, Meter, and Toggle Group while preserving public state and data attributes. The bundle bot is authoritative for the current size impact.
Changes
data-multiple, and enum-to-literal synchronization.