We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b83294e commit 6096558Copy full SHA for 6096558
packages/ui-components/src/Common/Select/index.tsx
@@ -3,7 +3,7 @@
3
import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
4
import * as SelectPrimitive from '@radix-ui/react-select';
5
import classNames from 'classnames';
6
-import { useId, useMemo, useState } from 'react';
+import { useEffect, useId, useMemo, useState } from 'react';
7
8
import Skeleton from '#ui/Common/Skeleton';
9
@@ -64,6 +64,8 @@ const Select = <T extends string>({
64
const id = useId();
65
const [value, setValue] = useState(defaultValue);
66
67
+ useEffect(() => setValue(defaultValue), [defaultValue]);
68
+
69
const mappedValues = useMemo(() => mapValues(values), [values]) as Array<
70
SelectGroup<T>
71
>;
0 commit comments