Skip to content

Commit 4e18111

Browse files
committed
fix: remove toaster logic from add key modal becuase of reactQuery
1 parent a8bd450 commit 4e18111

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/components/databrowser/components/add-key-modal.tsx

+9-17
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
SelectValue,
2424
} from "@/components/ui/select"
2525
import { Spinner } from "@/components/ui/spinner"
26-
import { toast } from "@/components/ui/use-toast"
2726
import { TypeTag } from "@/components/databrowser/components/type-tag"
2827
import { useAddKey } from "@/components/databrowser/hooks/use-add-key"
2928

@@ -43,23 +42,16 @@ export function AddKeyModal() {
4342
})
4443

4544
const onSubmit = handleSubmit(async ({ key, type }) => {
46-
try {
47-
await addKey({ key, type })
48-
setSelectedKey(key)
49-
setOpen(false)
50-
setTimeout(() => {
51-
window.document.querySelector(`[data-key="${key}"]`)?.scrollIntoView({
52-
behavior: "smooth",
53-
block: "start",
54-
inline: "nearest",
55-
})
56-
}, 100)
57-
} catch (error) {
58-
toast({
59-
description: error instanceof Error ? error.message : "An error occurred",
60-
variant: "destructive",
45+
await addKey({ key, type })
46+
setSelectedKey(key)
47+
setOpen(false)
48+
setTimeout(() => {
49+
window.document.querySelector(`[data-key="${key}"]`)?.scrollIntoView({
50+
behavior: "smooth",
51+
block: "start",
52+
inline: "nearest",
6153
})
62-
}
54+
}, 100)
6355
})
6456

6557
return (

0 commit comments

Comments
 (0)