Skip to content

Commit

Permalink
feat: vault category auto select
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmagnus committed Jan 24, 2024
1 parent e8e5988 commit 51a004e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ export const SelectCategory: React.FC<ISelectCategory> = ({
createVaultCategory,
setCategorySelected,
categorySelected,
clearErrors
clearErrors,
}) => {
const [isLoading, setIsLoading] = useState(false)
const [options, setOptions] = useState<IOption[]>([])
const [value, setValue] = useState<IOption>()

const { colorMode } = useColorMode()

Expand All @@ -41,6 +42,7 @@ export const SelectCategory: React.FC<ISelectCategory> = ({
setIsLoading(false)
setOptions(prev => [...prev, newOption])
setCategorySelected(newOption)
setValue(newOption)
}, 1000)
}

Expand All @@ -59,6 +61,7 @@ export const SelectCategory: React.FC<ISelectCategory> = ({
isLoading={isLoading}
onCreateOption={handleVaultCategory}
options={options}
value={value}
onChange={(newValue): void => {
if (clearErrors) clearErrors()
setCategorySelected(newValue)
Expand Down

0 comments on commit 51a004e

Please sign in to comment.