-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CustomSelectControlV2
: Fix initial value not being set in the select for the V1 legacy adapter
#62308
Conversation
…property of the `changeObject` that's passed to the `onChange` callback for the legacy adapter
…tom attributes as part of option and that they are not added to the DOM as attributes (same behavior as V1)
@@ -63,7 +63,8 @@ export { | |||
useCompositeState as __unstableUseCompositeState, | |||
} from './composite'; | |||
export { ConfirmDialog as __experimentalConfirmDialog } from './confirm-dialog'; | |||
export { StableCustomSelectControl as CustomSelectControl } from './custom-select-control'; | |||
//export { StableCustomSelectControl as CustomSelectControl } from './custom-select-control'; | |||
export { ClassicCustomSelectControlV2Adapter as CustomSelectControl } from './custom-select-control-v2/legacy-component'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be reverted before merging - it's here to allow testing the V1 adapter in the GB app. We shouldn't replace the classic V1 with the legacy adapter just yet (it'll be done in a follow-up PR).
Size Change: +4.64 kB (+0.27%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
6daa4b1
to
5882f00
Compare
7a1bc5c
to
c7530a3
Compare
c7530a3
to
192ac71
Compare
Closing as superseded by #62733 |
Split from: #61272.
Depends on: #62255.
What?
Fixes an issue in the legacy adapter where the initial
value
passed to the select wasn't being auto-selected, effectively causing a mismatch between the store and the rendered value.Why?
Consumers expect the select to have the option defined by the
value
prop selected when it mounts, but the legacy adapter was not doing that, e.g: if you selected an option, and the component was unmounted/mounted from scratch again, it would select the first option instead of the option defined byvalue
.IMPORTANT: V2 is still not replacing the classic V1 in the GB app yet. We'll eventually replace the classic export with the V1 adapter, and the commit here will be reverted before merging (it's here just to make it easier to test the adapter in the app while reviewing this PR).
How?
Ths PR fixes by making sure the value in the Ariakit store is selected upon mount from the
value
passed.Testing Instructions
Screenshots or screencast
beforefix1.mov
afterfix1.mov
NOTE: You may notice some styling issues in the select. These were already fixed in #61272 and will be split in a follow-up PR to this one.