From 92e5667b8176b935a786c0749955d040a53550cd Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 3 Dec 2024 18:55:06 +0000 Subject: [PATCH] prevent empty snippets being saved, don't crash for old empty snippets --- .../src/components/common/bindings/SnippetDrawer.svelte | 8 ++------ .../components/common/bindings/SnippetSidePanel.svelte | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/common/bindings/SnippetDrawer.svelte b/packages/builder/src/components/common/bindings/SnippetDrawer.svelte index d6b6f92b17..d8e56b059a 100644 --- a/packages/builder/src/components/common/bindings/SnippetDrawer.svelte +++ b/packages/builder/src/components/common/bindings/SnippetDrawer.svelte @@ -63,7 +63,7 @@ if (!name?.length) { return "Name is required" } - if (snippets.some(snippet => snippet.name === name)) { + if (!snippet?.name && snippets.some(snippet => snippet.name === name)) { return "That name is already in use" } if (firstCharNumberRegex.test(name)) { @@ -106,11 +106,7 @@ Delete {/if} - diff --git a/packages/builder/src/components/common/bindings/SnippetSidePanel.svelte b/packages/builder/src/components/common/bindings/SnippetSidePanel.svelte index c68699fc0f..2cc27b91cd 100644 --- a/packages/builder/src/components/common/bindings/SnippetSidePanel.svelte +++ b/packages/builder/src/components/common/bindings/SnippetSidePanel.svelte @@ -186,7 +186,7 @@
{#key hoveredSnippet}