From a4611b78b8817c810c8cf456076d72f3acff713c Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 2 Nov 2022 11:09:58 +0100 Subject: [PATCH] fix: can't add vars with same key name --- .../project-[project]/functions/wizard/step5.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/routes/console/project-[project]/functions/wizard/step5.svelte b/src/routes/console/project-[project]/functions/wizard/step5.svelte index 4b791b433..2bf16ebda 100644 --- a/src/routes/console/project-[project]/functions/wizard/step5.svelte +++ b/src/routes/console/project-[project]/functions/wizard/step5.svelte @@ -22,7 +22,16 @@ function handleCreated(dispatchEvent: CustomEvent) { createFunction.update((n) => { - n.vars.push(dispatchEvent.detail); + if (n.vars.length) { + n.vars.map((v) => { + if (v.key !== dispatchEvent.detail.key) { + n.vars.push(dispatchEvent.detail); + } + }); + } else { + n.vars.push(dispatchEvent.detail); + } + return n; }); }