From 9a3d458e3075dd1e5d805cfc35b93a0bda4984a9 Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Tue, 2 Jan 2024 13:09:59 +0100 Subject: [PATCH] Fix persisting cloud sync setting --- .../[projectId]/settings/CloudForm.svelte | 52 ++++++++----------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/gitbutler-ui/src/routes/[projectId]/settings/CloudForm.svelte b/gitbutler-ui/src/routes/[projectId]/settings/CloudForm.svelte index 5462b8e81..c2e437650 100644 --- a/gitbutler-ui/src/routes/[projectId]/settings/CloudForm.svelte +++ b/gitbutler-ui/src/routes/[projectId]/settings/CloudForm.svelte @@ -29,12 +29,8 @@ dispatch('updated', { ...project, api: { ...cloudProject, sync: project.api.sync } }); }); - const onSyncChange = async (event: Event) => { + const onSyncChange = async (event: CustomEvent) => { if (!user) return; - - const target = event.target as HTMLInputElement; - const sync = target.checked; - try { const cloudProject = project.api ?? @@ -43,7 +39,7 @@ description: project.description, uid: project.id })); - dispatch('updated', { ...project, api: { ...cloudProject, sync } }); + dispatch('updated', { ...project, api: { ...cloudProject, sync: event.detail } }); } catch (error) { console.error(`Failed to update project sync status: ${error}`); toasts.error('Failed to update project sync status'); @@ -63,18 +59,16 @@ class="flex flex-row items-center justify-between rounded-lg border border-light-400 p-2 dark:border-dark-500" >
-
-
- { - $aiGenEnabled = !$aiGenEnabled; - }} - /> - - +
+ { + $aiGenEnabled = !$aiGenEnabled; + }} + /> +
@@ -86,18 +80,16 @@ class="flex flex-row items-center justify-between rounded-lg border border-light-400 p-2 dark:border-dark-500" >
-
-
- - - +
+ +