From 7a485e2fb47ea41438207a8375096a468299bbee Mon Sep 17 00:00:00 2001 From: Ricardo Amendoeira Date: Thu, 12 Aug 2021 01:40:52 +0100 Subject: [PATCH 1/6] Fix delete button not being disabled while waiting for response --- .../templates/default/src/routes/todos/index.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/create-svelte/templates/default/src/routes/todos/index.svelte b/packages/create-svelte/templates/default/src/routes/todos/index.svelte index 224e1ef79533..c4af774d0766 100644 --- a/packages/create-svelte/templates/default/src/routes/todos/index.svelte +++ b/packages/create-svelte/templates/default/src/routes/todos/index.svelte @@ -59,6 +59,7 @@ use:enhance={{ result: async (res, form) => { const created = await res.json(); + created.pending_delete = false; todos = [...todos, created]; form.reset(); @@ -105,12 +106,13 @@ action="/todos/{todo.uid}.json?_method=delete" method="post" use:enhance={{ + pending: () => todo.pending_delete = true, result: () => { todos = todos.filter((t) => t.uid !== todo.uid); } }} > -