Skip to content

[combobox][select] Fix inconsistent isItemEqualToValue argument order - #4056

Merged
atomiks merged 1 commit into
mui:masterfrom
atomiks:codex/fix-item-equality-arg-order
Feb 12, 2026
Merged

atomiks merged 1 commit into
mui:masterfrom
atomiks:codex/fix-item-equality-arg-order

Conversation

@atomiks

@atomiks atomiks commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

The order of args was sometimes inconsistent here and did not match the types.

@atomiks atomiks added component: select Changes related to the select component. type: bug It doesn't behave as expected. component: combobox Changes related to the combobox component. labels Feb 12, 2026
@pkg-pr-new

pkg-pr-new Bot commented Feb 12, 2026 •

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

  • vite-css-base-ui-example

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

commit: 07b9e3f

@mui-bot

mui-bot commented Feb 12, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+26B(+0.01%) 🔺+21B(+0.02%)

Details of bundle changes


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

@netlify

netlify Bot commented Feb 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 07b9e3f
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/698db5b0b9c5270008198d74
😎 Deploy Preview https://deploy-preview-4056--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.

@atomiks
atomiks force-pushed the codex/fix-item-equality-arg-order branch from 289a6b7 to 07b9e3f Compare February 12, 2026 11:12
@atomiks
atomiks marked this pull request as ready for review February 12, 2026 11:17
@greptile-apps

greptile-apps Bot commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR fixes an inconsistency in the argument order for the isItemEqualToValue comparator function across combobox and select components. The fix ensures that itemValue is always passed as the first argument and selectedValue as the second argument, matching the type signatures.

  • Standardized parameter naming in itemEquality.ts utility functions (itemValue first, selectedValue second)
  • Updated all call sites in combobox and select components to use consistent argument order
  • Renamed itemIncludes to selectedValueIncludes to better reflect its purpose
  • Added comprehensive tests in both ComboboxRoot.test.tsx and SelectRoot.test.tsx that verify the argument order using object properties with source fields
  • Updated generated API documentation

The fix is particularly important for users providing custom isItemEqualToValue functions with objects, as they were receiving arguments in an inconsistent order that didn't match the documented types.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are systematic, well-tested, and fix a real bug where argument order was inconsistent with type signatures. All call sites have been updated consistently, comprehensive tests verify the fix works correctly, and the changes maintain backwards compatibility for users relying on default equality (Object.is). The refactoring improves code clarity through better variable naming.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/utils/itemEquality.ts Standardized parameter naming and argument order in equality utilities to consistently use itemValue first, selectedValue second
packages/react/src/combobox/item/ComboboxItem.tsx Renamed value prop to itemValue internally and updated all compareItemEquality calls to pass arguments in correct order
packages/react/src/combobox/root/AriaCombobox.tsx Updated compareItemEquality calls to use consistent argument order, renamed itemIncludes to selectedValueIncludes, improved variable naming
packages/react/src/combobox/store.ts Updated isSelected selector to pass itemValue as first argument to compareItemEquality
packages/react/src/select/item/SelectItem.tsx Renamed value prop to itemValue internally and updated compareItemEquality calls to correct argument order
packages/react/src/select/store.ts Updated isSelected selector to pass itemValue as first argument to compareItemEquality

@atomiks
atomiks merged commit cab69de into mui:master Feb 12, 2026
8 checks passed
@atomiks
atomiks deleted the codex/fix-item-equality-arg-order branch February 12, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: combobox Changes related to the combobox component. component: select Changes related to the select component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants