[select] Synchronize root props through the store - #5589
Open
flaviendelangle wants to merge 1 commit into
Open
Conversation
flaviendelangle
requested review from
atomiks,
colmtuite,
jjenzz and
michaldudak
as code owners
August 28, 2026 10:05
commit: |
Bundle size
PerformanceTotal duration: 1,075.57 ms -114.26 ms(-9.6%) | Renders: 76 (+0) | Paint: 1,731.62 ms -218.59 ms(-11.2%)
13 tests within noise — details Check out the code infra dashboard for more information about this PR. |
Member
Author
|
@atomiks maybe you have more insight about why the Select and the Combobox were not behaving the same way here. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Select still sends root values such as
disabled,readOnly, andrequiredthrough a separate React context after #5582. Combobox sends the equivalent values through its selector-based store. This PR makes Select follow the Combobox model.What changed
disabled,readOnly,required,multiple,highlightItemOnHover, anditemPropsinto the Select store.SelectRootPropsContext.itemPropsbefore the first descendant render and synchronize later root updates in the existing atomic store transaction.disabledsynchronization and its commit timing.Trade-off
The removed context propagated new root props during the same render. Descendant ref callbacks therefore saw an updated
disabledvalue during that commit.store.useSyncedValuespublishes changes from the root's layout effect, after descendant ref callbacks have run. Store subscribers then rerender before the browser paints, so the rendered DOM and interactions after the commit use the new value. There is one narrower window: if a consumer performs an imperative interaction from a descendant ref callback during the exact commit that changesdisabledfromfalsetotrue, the handler still seesfalseand can commit a selection. The updated characterization test pins this case.This gives up Select's stronger same-commit guarantee in that ref-callback window. In return, changing one root value no longer invalidates every consumer of the combined context, including every mounted item, and Select now has the same propagation semantics as Combobox. Keeping synchronous ref-callback behavior would require retaining a separate context with its broader rerender fan-out, or changing the shared store synchronization model for both components.
Verification
pnpm test:jsdom Select --no-watch(506 passed, 71 skipped)pnpm test:chromium Select --no-watch(558 passed, 19 skipped)pnpm typescriptpnpm eslintpnpm prettier