We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 47158ef commit 46512afCopy full SHA for 46512af
1 file changed
src/components/Elements/ChipsSet/ChipsSet.tsx
@@ -1,5 +1,5 @@
1
import clsx from 'clsx'
2
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
3
import { IoIosClose } from 'react-icons/io'
4
import { Option } from 'src/types'
5
import './chipset.css'
@@ -48,6 +48,10 @@ export const ChipsSet = ({
48
}: ChipsSetProps) => {
49
const [selectedChips, setSelectedChips] = useState<string[] | undefined>(defaultValues || [])
50
51
+ useEffect(() => {
52
+ setSelectedChips(defaultValues || [])
53
+ }, [defaultValues])
54
+
55
const onSelect = (option: Option) => {
56
if (selectedChips?.some((chipValue) => chipValue === option.value)) {
57
if (!canSelectMultiple) {
0 commit comments