From 34c3498144e136fbe1d60281ad54111c02ab5b79 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Thu, 29 Feb 2024 13:02:47 +0000
Subject: fix: Delete URL on successful bookmark

---
 packages/web/app/dashboard/bookmarks/components/AddBookmark.tsx | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'packages/web/app/dashboard/bookmarks/components/AddBookmark.tsx')

diff --git a/packages/web/app/dashboard/bookmarks/components/AddBookmark.tsx b/packages/web/app/dashboard/bookmarks/components/AddBookmark.tsx
index 4f0de87a..d12fc663 100644
--- a/packages/web/app/dashboard/bookmarks/components/AddBookmark.tsx
+++ b/packages/web/app/dashboard/bookmarks/components/AddBookmark.tsx
@@ -32,12 +32,16 @@ function AddLink() {
   });
   const form = useForm<z.infer<typeof formSchema>>({
     resolver: zodResolver(formSchema),
+    defaultValues: {
+      url: "",
+    },
   });
 
   const invalidateBookmarksCache = api.useUtils().bookmarks.invalidate;
   const createBookmarkMutator = api.bookmarks.createBookmark.useMutation({
     onSuccess: () => {
       invalidateBookmarksCache();
+      form.reset();
     },
     onError: () => {
       toast({ description: "Something went wrong", variant: "destructive" });
-- 
cgit v1.2.3-70-g09d2

