-
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
CustomSelectControl: Refactor to use Ariakit store state for current value #67815
CustomSelectControl: Refactor to use Ariakit store state for current value #67815
Conversation
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. |
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.
Thanks, @yogeshbhutkar! I can confirm that this fixes the issue.
Let's add a changelog entry. I think this is a good merge.
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.
Confirming this looks good and works well. Happy to ship once we have a CHANGELOG entry as @Mamaduka suggested.
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.
Oh great, nice clean fix! Thank you 🙌
Added changelog entry. CC: @Mamaduka |
packages/components/CHANGELOG.md
Outdated
@@ -46,6 +46,7 @@ | |||
|
|||
- `ResizableBox`: Make drag handles focusable ([#67305](https://github.com/WordPress/gutenberg/pull/67305)). | |||
- `CustomSelectControl`: Update correctly when `showSelectedHint` is enabled ([#67733](https://github.com/WordPress/gutenberg/pull/67733)). | |||
- `CustomSelectControl`: use `useStoreState` to get `currentValue` for optimistic updates ([#67815](https://github.com/WordPress/gutenberg/pull/67815)) |
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.
- `CustomSelectControl`: use `useStoreState` to get `currentValue` for optimistic updates ([#67815](https://github.com/WordPress/gutenberg/pull/67815)) | |
- `CustomSelectControl`: Use `useStoreState` to get `currentValue` and avoid stale values ([#67815](https://github.com/WordPress/gutenberg/pull/67815)). |
A minor suggestion. The optimistic updates refer to a different pattern, especially after the React 19 release.
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.
Thanks for the suggestion @Mamaduka. Fixed in the latest commit 🚀.
…value (WordPress#67815) Co-authored-by: yogeshbhutkar <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: tyxla <[email protected]> Co-authored-by: mirka <[email protected]>
Fixes: #67759
What?
This PR fixes a bug where the Button component's description fails to update correctly when uncontrolled.
How?
The implementation replaces
store.getState()
withAriakit.useStoreState(store)
to accurately retrieve the current value, ensuring the description updates as expected.Testing Instructions
Screencast
Before:
custom-select-control-before-720p.mov
After: