From 39ac45aa4b76e18005cc5cd1e8f1634f1093e768 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Wed, 11 Dec 2024 14:51:32 +0530 Subject: [PATCH] CustomSelectControl: Refactor and revert code changes made in #67733 --- packages/components/src/custom-select-control/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/components/src/custom-select-control/index.tsx b/packages/components/src/custom-select-control/index.tsx index 11a470d0446dee..6d6ac3b925febc 100644 --- a/packages/components/src/custom-select-control/index.tsx +++ b/packages/components/src/custom-select-control/index.tsx @@ -116,8 +116,6 @@ function CustomSelectControl< T extends CustomSelectOption >( defaultValue: options[ 0 ]?.name, } ); - const { value: currentValue } = Ariakit.useStoreState( store ); - const children = options .map( applyOptionDeprecations ) .map( ( { name, key, hint, style, className } ) => { @@ -151,10 +149,12 @@ function CustomSelectControl< T extends CustomSelectOption >( ); } ); + const { value: currentValue } = Ariakit.useStoreState( store ); + const renderSelectedValueHint = () => { const selectedOptionHint = options ?.map( applyOptionDeprecations ) - ?.find( ( { name } ) => store.getState().value === name )?.hint; + ?.find( ( { name } ) => currentValue === name )?.hint; return (