Skip to content

[progress][meter][toggle group] Reduce bundle size - #5224

Merged
atomiks merged 3 commits into
mui:masterfrom
atomiks:codex/progress-meter-toggle-group-cleanup
Jul 13, 2026
Merged

atomiks merged 3 commits into
mui:masterfrom
atomiks:codex/progress-meter-toggle-group-cleanup

Conversation

@atomiks

@atomiks atomiks commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Simplify the Progress status mapping and remove unused context fields.
  • Remove unused Meter range fields and Toggle Group context and mapper overhead.
  • Add regression coverage for status attributes, data-multiple, and enum-to-literal synchronization.

@atomiks atomiks added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: all components Widespread work has an impact on almost all components. labels Jul 13, 2026 — with ChatGPT Codex Connector
@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5224
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5224
    

commit: a008788

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-578B(-0.13%) ▼-147B(-0.10%)

Details of bundle changes

Performance

Total duration: 1,581.51 ms +154.36 ms(+10.8%) | Renders: 78 (+0) | Paint: 2,485.72 ms +252.29 ms(+11.3%)

Test Duration Renders
Tabs mount (200 instances) 292.44 ms 🔺+52.27 ms(+21.8%) 4 (+0)
Menu mount (300 instances) 177.26 ms 🔺+37.81 ms(+27.1%) 2 (+0)
Slider mount (300 instances) 216.88 ms 🔺+36.47 ms(+20.2%) 3 (+0)
Popover mount (300 instances) 90.11 ms 🔺+22.38 ms(+33.0%) 1 (+0)
Menu open (500 items) 104.90 ms 🔺+20.71 ms(+24.6%) 12 (+0)

…and 1 more (+8 within noise) — details

Metric alarms

Test Metric Change
Tabs mount (200 instances) bench:paint 🔺 +87.39 ms
Menu mount (300 instances) bench:paint 🔺 +56.52 ms
Slider mount (300 instances) bench:paint 🔺 +60.65 ms
Popover mount (300 instances) bench:paint 🔺 +35.80 ms
Menu open (500 items) bench:paint 🔺 +37.21 ms

…and 2 more metric alarms — details


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit a008788
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a54fb5adf710a0008c901aa
😎 Deploy Preview https://deploy-preview-5224--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks atomiks added performance component: progress Changes related to the progress component. component: meter Changes related to the meter component. component: toggle group Changes related to the toggle group component. and removed type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: all components Widespread work has an impact on almost all components. labels Jul 13, 2026
@atomiks atomiks changed the title [all components] Reduce bundle size of Progress, Meter, and ToggleGroup [progress][meter][toggle group] Reduce bundle size Jul 13, 2026
@atomiks
atomiks marked this pull request as ready for review July 13, 2026 10:09
@atomiks
atomiks force-pushed the codex/progress-meter-toggle-group-cleanup branch from 3a4dc65 to 9d21444 Compare July 13, 2026 12:08
@atomiks
atomiks requested a review from Copilot July 13, 2026 12:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-multiple mapping 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-multiple and Progress status data-* 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.

@atomiks
atomiks force-pushed the codex/progress-meter-toggle-group-cleanup branch from 4dbba4a to a008788 Compare July 13, 2026 14:51
@atomiks
atomiks merged commit c33f421 into mui:master Jul 13, 2026
7 checks passed
@atomiks
atomiks deleted the codex/progress-meter-toggle-group-cleanup branch August 11, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: meter Changes related to the meter component. component: progress Changes related to the progress component. component: toggle group Changes related to the toggle group component. performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants