diff options
Diffstat (limited to 'apps/web/components')
| -rw-r--r-- | apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx b/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx index f0ede24e..021a7b05 100644 --- a/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx +++ b/apps/web/components/dashboard/bookmarks/EditBookmarkDialog.tsx @@ -27,6 +27,7 @@ import { } from "@/components/ui/popover"; import { Textarea } from "@/components/ui/textarea"; import { toast } from "@/components/ui/use-toast"; +import { useDialogFormReset } from "@/lib/hooks/useDialogFormReset"; import { useTranslation } from "@/lib/i18n/client"; import { cn } from "@/lib/utils"; import { zodResolver } from "@hookform/resolvers/zod"; @@ -124,12 +125,10 @@ export function EditBookmarkDialog({ updateBookmarkMutate(payload); } - // Reset form when bookmark data changes externally or dialog reopens - React.useEffect(() => { - if (open) { - form.reset(bookmarkToDefault(bookmark)); - } - }, [bookmark, form, open]); + // Reset form only when dialog is initially opened to preserve unsaved changes + // This prevents losing unsaved title edits when tags are updated, which would + // cause the bookmark prop to change and trigger a form reset + useDialogFormReset(open, form, bookmarkToDefault(bookmark)); const isLink = bookmark.content.type === BookmarkTypes.LINK; const isAsset = bookmark.content.type === BookmarkTypes.ASSET; |
