mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 00:02:30 +00:00
Empty paths used to be in-memory only (via the `isLocalOnly` short-circuit)
because we worried about collisions between concurrent /add tabs. The user
asked for the trade-off to flip: a /flows/add or /scripts/add reload should
restore the user's work, while explicitly clicking "+ Flow / + Script / …"
should always open a clean editor.
- Drop `isLocalOnly` from UserDraft so empty-path entries persist under
`userdraft/w/{ws}/{kind}/` like any other path. The existing per-kind
refcounting and saveInitialValue=false behavior already handle them
correctly — the change is just lifting the bypass.
- Each /add page now calls `UserDraft.remove(kind, '')` synchronously
when `?nodraft=true` is present in the URL, before the handle is
created.
- The two "+" entry points that lacked the `?nodraft=true` flag
(CreateActionsScript's plain `<a href>` and CreateActionsFlow's
YAML/JSON import paths) now include it, so every fresh-start path goes
through the wipe.
- Tests updated: the "empty path (in-memory only)" block becomes
"empty path (persists across reloads)" and asserts the new behavior.
23 lines
504 B
Svelte
23 lines
504 B
Svelte
<script lang="ts">
|
|
import { base } from '$lib/base'
|
|
import { Code2, Plus } from 'lucide-svelte'
|
|
import { Button } from '$lib/components/common'
|
|
|
|
let { aiId, aiDescription }: { aiId: string; aiDescription: string } = $props()
|
|
</script>
|
|
|
|
<div class="flex flex-row gap-2">
|
|
<Button
|
|
id="create-script-button"
|
|
{aiId}
|
|
{aiDescription}
|
|
unifiedSize="lg"
|
|
variant="accent"
|
|
startIcon={{ icon: Plus }}
|
|
href="{base}/scripts/add?nodraft=true"
|
|
endIcon={{ icon: Code2 }}
|
|
>
|
|
Script
|
|
</Button>
|
|
</div>
|