Repository navigation
[select] Fix dirty state not clearing in multiple mode - #4971
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,632.21 ms +75.51 ms(+4.9%) | Renders: 50 (+0) | Paint: 2,436.91 ms +106.59 ms(+4.6%) No significant changes — 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. |
Code Review (GPT-5.5)Approve ✅ The dirty-state fix is narrowly scoped, uses the existing order-sensitive equality utilities correctly, and the added regression tests cover the important multiple-select cases. 1. Bugs / Issues (None)No branch-relevant bugs or blocking issues found. 2. Root Cause & Patch AssessmentThe patch addresses the actual failure mode: multiple Select values are arrays, so reference comparison kept 3. Pattern Consistency AssessmentThe order-sensitive comparison is consistent with the existing 4. Test Coverage AssessmentCoverage looks appropriate for this bug fix: it includes returning to the initial primitive value, object values compared through Validation run:
|
In a multiple Select inside a Field,
[data-dirty]stayed set after the selection returned to its initial value.Root cause
The dirty check used
value !== validityData.initialValue. In multiple modevalueis a fresh array on every change, so the reference comparison was always true once the user interacted — even after deselecting and reselecting back to the initial items.Changes
isItemEqualToValuewhen computing dirty state in multiple mode, falling back to reference comparison for non-array values. This mirrors the equivalent combobox fix.isItemEqualToValue, and the order-sensitive case.Notes
CheckboxGroupandSlider. Returning to the same items in a different order is still treated as dirty.