diff --git a/packages/material-tailwind-react/src/components/Select/index.tsx b/packages/material-tailwind-react/src/components/Select/index.tsx index 5b1b65c1c..d5908ad02 100644 --- a/packages/material-tailwind-react/src/components/Select/index.tsx +++ b/packages/material-tailwind-react/src/components/Select/index.tsx @@ -205,8 +205,14 @@ const Select = React.forwardRef( }); React.useEffect(() => { + listContentRef.current = [ + ...(React.Children.map(children, (child) => { + const { props }: any = child; + return props?.value; + }) ?? []), + ] setSelectedIndex(Math.max(0, listContentRef.current.indexOf(value) + 1)); - }, [value]); + }, [value, children]); const floatingRef = refs.floating;