Skip to content

Commit

Permalink
CustomSelectControl: Update Value from Fresh State (#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

1 comment on commit 9387206

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 9387206.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12262288736
📝 Reported issues:

Please sign in to comment.