Skip to content

[autocomplete] Remove unnecessary double stringification of item in filtering logic - #3945

Merged
ZeeshanTamboli merged 2 commits into
mui:masterfrom
ZeeshanTamboli:remove-double-stringify-filtering-autocomplete
Feb 3, 2026
Merged

ZeeshanTamboli merged 2 commits into
mui:masterfrom
ZeeshanTamboli:remove-double-stringify-filtering-autocomplete

Conversation

@ZeeshanTamboli

Copy link
Copy Markdown
Member

contains method already stringify the item as label. Avoid double doing it.

@ZeeshanTamboli ZeeshanTamboli 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. component: autocomplete Changes related to the autocomplete component. labels Feb 3, 2026
@ZeeshanTamboli ZeeshanTamboli changed the title [autocomplete] Remove unnecessary double stringication of item in filtering logic [autocomplete] Remove unnecessary double stringification of item in filtering logic Feb 3, 2026
@pkg-pr-new

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

commit: 1176a8b

@mui-bot

mui-bot commented Feb 3, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react ▼-20B(0.00%) ▼-9B(-0.01%)

Details of bundle changes


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

@netlify

netlify Bot commented Feb 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 1176a8b
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6981ae4ba5eb6900082dcd7d
😎 Deploy Preview https://deploy-preview-3945--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@ZeeshanTamboli
ZeeshanTamboli marked this pull request as ready for review February 3, 2026 08:15
@greptile-apps

greptile-apps Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR removes unnecessary double stringification in the autocomplete filtering logic. The collator.contains method already calls stringifyAsLabel(item, itemToString) internally (packages/react/src/combobox/root/utils/useFilter.ts:55), so the wrapper function that was manually stringifying before calling contains was redundant.

Changes:

  • Simplified baseFilter to directly return collator.contains instead of wrapping it
  • Removed redundant call to stringifyAsLabel that was duplicating work already done inside contains
  • Maintains exact same behavior while improving code clarity and performance

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Clean refactoring that removes redundant code without changing behavior. The contains method signature matches exactly what's expected, and it already handles stringification internally, making the wrapper unnecessary.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/autocomplete/root/AutocompleteRoot.tsx Removed redundant stringification wrapper, directly using collator.contains which already handles stringification internally

@ZeeshanTamboli
ZeeshanTamboli merged commit 5de22a1 into mui:master Feb 3, 2026
8 checks passed
@ZeeshanTamboli
ZeeshanTamboli deleted the remove-double-stringify-filtering-autocomplete branch February 3, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: autocomplete Changes related to the autocomplete component. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants