From 227049ef4dc97270db25827ea577467b93fd3200 Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Thu, 28 Jul 2022 23:02:21 +0100 Subject: [PATCH] Recalculate positions --- frontend/src/views/Forms.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/Forms.svelte b/frontend/src/views/Forms.svelte index cc7de6b..d622709 100644 --- a/frontend/src/views/Forms.svelte +++ b/frontend/src/views/Forms.svelte @@ -177,11 +177,12 @@ } function addInput() { - if (formLength >= 5) return; + const form = getForm(activeFormId); + if (form.inputs.length >= 5) return; const input = { form_id: activeFormId, - position: formLength + 1, + position: form.inputs.length + 1, style: "1", label: "", placeholder: "", @@ -189,7 +190,6 @@ is_new: true, }; - const form = getForm(activeFormId); form.inputs = [...form.inputs, input]; forms = forms; }