diff options
| author | MohamedBassem <me@mbassem.com> | 2024-10-06 17:48:17 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-10-06 17:48:17 +0000 |
| commit | 09e06591b2fbc3e3d81996204cfd34bd1c73db2f (patch) | |
| tree | 9b2c391a1c589e95c478e4481047c19290ca16dd /apps/web/components | |
| parent | 1e5c575e16c8a9e6bd7592e83bea53af7f359e15 (diff) | |
| download | karakeep-09e06591b2fbc3e3d81996204cfd34bd1c73db2f.tar.zst | |
fix(web): Fix sidebar list edit dialog not working. Fixes #447
Diffstat (limited to 'apps/web/components')
| -rw-r--r-- | apps/web/components/dashboard/lists/EditListModal.tsx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/apps/web/components/dashboard/lists/EditListModal.tsx b/apps/web/components/dashboard/lists/EditListModal.tsx index 993c975b..cba1a0e6 100644 --- a/apps/web/components/dashboard/lists/EditListModal.tsx +++ b/apps/web/components/dashboard/lists/EditListModal.tsx @@ -156,6 +156,11 @@ export function EditListModal({ const isEdit = !!list; const isPending = isCreating || isEditing; + const onSubmit = form.handleSubmit((value: z.infer<typeof formSchema>) => { + value.parentId = value.parentId === "" ? null : value.parentId; + isEdit ? editList({ ...value, listId: list.id }) : createList(value); + }); + return ( <Dialog open={open} @@ -167,14 +172,7 @@ export function EditListModal({ {children && <DialogTrigger asChild>{children}</DialogTrigger>} <DialogContent> <Form {...form}> - <form - onSubmit={form.handleSubmit((value) => { - value.parentId = value.parentId === "" ? null : value.parentId; - isEdit - ? editList({ ...value, listId: list.id }) - : createList(value); - })} - > + <form onSubmit={onSubmit}> <DialogHeader> <DialogTitle>{isEdit ? "Edit" : "New"} List</DialogTitle> </DialogHeader> @@ -264,7 +262,11 @@ export function EditListModal({ Close </Button> </DialogClose> - <ActionButton type="submit" loading={isPending}> + <ActionButton + type="submit" + onClick={onSubmit} + loading={isPending} + > {list ? "Save" : "Create"} </ActionButton> </DialogFooter> |
