Clean state

This commit is contained in:
Adria Navarro 2025-03-03 14:12:36 +01:00
parent f352e65780
commit 84fefc3dd8
1 changed files with 9 additions and 1 deletions

View File

@ -17,7 +17,15 @@
import { ValidSnippetNameRegex } from "@budibase/shared-core"
import type { Snippet } from "@budibase/types"
export const show = () => drawer.show()
export const show = () => {
if (!snippet) {
key = Math.random().toString()
// Reset state when creating multiple snippets
code = ""
name = defaultName
}
drawer.show()
}
export const hide = () => drawer.hide()
export let snippet: Snippet | null