Skip to content

Commit a84a8f9

Browse files
subodhr258subodhr258mirkasarthaknagoshe2002Rishit30G
authored andcommitted
CustomSelectControl: Update Value from Fresh State (WordPress#67733)
* 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 <subodhrajpopat@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: sarthaknagoshe2002 <sarthaknagoshe2002@git.wordpress.org> Co-authored-by: Rishit30G <rishit30g@git.wordpress.org> Co-authored-by: inc2734 <inc2734@git.wordpress.org>
1 parent a58bf04 commit a84a8f9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/components/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
### Bug Fixes
4646

4747
- `ResizableBox`: Make drag handles focusable ([#67305](https://github.com/WordPress/gutenberg/pull/67305)).
48+
- `CustomSelectControl`: Update correctly when `showSelectedHint` is enabled ([#67733](https://github.com/WordPress/gutenberg/pull/67733)).
4849

4950
## 28.13.0 (2024-11-27)
5051

packages/components/src/custom-select-control/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ function CustomSelectControl< T extends CustomSelectOption >(
154154
const renderSelectedValueHint = () => {
155155
const selectedOptionHint = options
156156
?.map( applyOptionDeprecations )
157-
?.find( ( { name } ) => currentValue === name )?.hint;
157+
?.find( ( { name } ) => store.getState().value === name )?.hint;
158158

159159
return (
160160
<Styled.SelectedExperimentalHintWrapper>
161-
{ currentValue }
161+
{ store.getState().value }
162162
{ selectedOptionHint && (
163163
<Styled.SelectedExperimentalHintItem
164164
// Keeping the classname for legacy reasons

0 commit comments

Comments
 (0)