Skip to content

[all components] Reduce selector bundle size - #5250

Merged
atomiks merged 1 commit into
mui:masterfrom
atomiks:codex/remove-redundant-selector-factories
Jul 21, 2026
Merged

atomiks merged 1 commit into
mui:masterfrom
atomiks:codex/remove-redundant-selector-factories

Conversation

@atomiks

@atomiks atomiks commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Remove redundant internal selector factories without changing the public store utility.

Changes

  • Use selector functions directly when no composition is needed.
  • Keep Toast selector state and ID arguments explicit.
  • Reduce @base-ui/react by 1,067 parsed bytes and 256 gzipped bytes.

@atomiks atomiks added performance scope: all components Widespread work has an impact on almost all components. labels Jul 16, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 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@5250
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5250
    

commit: d631ed0

@code-infra-dashboard

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

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-1.07KB(-0.24%) ▼-218B(-0.15%)

Details of bundle changes

Performance

Total duration: 1,080.52 ms -87.55 ms(-7.5%) | Renders: 78 (+0) | Paint: 1,691.64 ms -142.89 ms(-7.8%)

No significant changes — details


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

@netlify

netlify Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit d631ed0
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a5f3b0757004c0008237909
😎 Deploy Preview https://deploy-preview-5250--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 marked this pull request as ready for review July 16, 2026 05:45
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 16, 2026
@atomiks
atomiks force-pushed the codex/remove-redundant-selector-factories branch from 2d3bbc5 to 17b1d1f Compare July 16, 2026 08:33
@github-actions github-actions Bot added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels Jul 16, 2026
@atomiks
atomiks force-pushed the codex/remove-redundant-selector-factories branch from 17b1d1f to d631ed0 Compare July 21, 2026 09:25
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 21, 2026
@atomiks
atomiks requested a review from Copilot July 21, 2026 09:29

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 @base-ui/react bundle size by removing redundant uses of the internal createSelector factory and replacing them with direct selector functions, without changing the public store utilities.

Changes:

  • Replace createSelector(...) wrappers with direct (state, ...args) => ... selectors across popup-related stores and other component stores.
  • Keep selector arguments explicit (notably Toast selectors that depend on id) while removing intermediate selector helpers.
  • Remove now-unneeded createSelector imports (and switch to import type where applicable).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/react/src/utils/popups/store.ts Replaces internal popup selectors with direct functions and updates imports accordingly.
packages/react/src/tooltip/store/TooltipStore.ts Converts Tooltip store selectors from createSelector to direct selector functions.
packages/react/src/toast/store.ts Inlines Toast selectors directly against state (including id-param selectors), removing selector factory usage.
packages/react/src/select/store.ts Converts Select store selectors to direct selector functions (including multi-arg selectors).
packages/react/src/preview-card/store/PreviewCardStore.ts Converts PreviewCard store selectors to direct selector functions.
packages/react/src/popover/store/PopoverStore.ts Converts Popover store selectors to direct selector functions.
packages/react/src/menu/store/MenuStore.ts Converts Menu store selectors to direct selector functions, preserving parent-store lookups.
packages/react/src/floating-ui-react/components/FloatingRootStore.ts Converts FloatingRoot store selectors to direct selector functions.
packages/react/src/dialog/store/DialogStore.ts Converts Dialog store selectors to direct selector functions.
packages/react/src/combobox/store.ts Converts Combobox store selectors to direct selector functions (including multi-arg selectors).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@atomiks
atomiks merged commit ee38be3 into mui:master Jul 21, 2026
6 checks passed
@atomiks
atomiks deleted the codex/remove-redundant-selector-factories branch July 21, 2026 09:36
flaviendelangle added a commit to flaviendelangle/mui-x that referenced this pull request Aug 24, 2026
Remove internal selector factories that don't memoize: createSelector with
a single function argument returns it unchanged, and composed
non-memoized selectors re-run their inputs on every call anyway, so both
forms only added bundle size. createSelectorMemoized selectors are
untouched.

Same technique as mui/base-ui#5250.

Co-Authored-By: Claude Fable 5 <[email protected]>
flaviendelangle added a commit to flaviendelangle/mui-x that referenced this pull request Aug 24, 2026
Remove internal selector factories that don't memoize: createSelector with
a single function argument returns it unchanged, and composed
non-memoized selectors re-run their inputs on every call anyway, so both
forms only added bundle size. createSelectorMemoized selectors are
untouched.

Same technique as mui/base-ui#5250.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance scope: all components Widespread work has an impact on almost all components.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants