Skip to content

Commit

Permalink
CustomSelectControl: Update Value from Fresh State (WordPress#67733)
Browse files Browse the repository at this point in the history
* CustomSelectControl: Prioritized props value over store

* CustomSelectControl: Refactored Codebase to fix failing testcases

* docs: Add changelog entry for CustomSelectControl font size reset fix

* CustomSelectControl: Fetch the fresh state on each call instead of stale state

* Tweak changelog text

---------

Co-authored-by: subodhr258 <[email protected]>
Co-authored-by: mirka <[email protected]>
Co-authored-by: sarthaknagoshe2002 <[email protected]>
Co-authored-by: Rishit30G <[email protected]>
Co-authored-by: inc2734 <[email protected]>
  • Loading branch information
6 people authored Dec 10, 2024
1 parent 2eec579 commit 9387206
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
### Bug Fixes

- `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)).

## 28.13.0 (2024-11-27)

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/custom-select-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ function CustomSelectControl< T extends CustomSelectOption >(
const renderSelectedValueHint = () => {
const selectedOptionHint = options
?.map( applyOptionDeprecations )
?.find( ( { name } ) => currentValue === name )?.hint;
?.find( ( { name } ) => store.getState().value === name )?.hint;

return (
<Styled.SelectedExperimentalHintWrapper>
{ currentValue }
{ store.getState().value }
{ selectedOptionHint && (
<Styled.SelectedExperimentalHintItem
// Keeping the classname for legacy reasons
Expand Down

0 comments on commit 9387206

Please sign in to comment.