From 2b9579e2faccef2b7e6b6ac538e9499264e31695 Mon Sep 17 00:00:00 2001 From: Christen Date: Fri, 3 Nov 2023 21:09:26 +0100 Subject: [PATCH] prevent formDefaults undesired mutation --- src/routes/[username]/edit/+page.svelte | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/routes/[username]/edit/+page.svelte b/src/routes/[username]/edit/+page.svelte index 717c4cc..561e1d8 100644 --- a/src/routes/[username]/edit/+page.svelte +++ b/src/routes/[username]/edit/+page.svelte @@ -26,7 +26,7 @@ title: "", url: "https://", }; - const formData = writable(formDefaults); + const formData = writable({...formDefaults}); let showForm = false; @@ -50,11 +50,7 @@ }), }); - formData.set({ - icon: "", - title: "", - url: "", - }); + formData.set({...formDefaults}); showForm = false; } @@ -74,7 +70,7 @@ } function cancelLink() { - formData.set(formDefaults); + formData.set({...formDefaults}); showForm = false; }