mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-19 08:03:16 +00:00
fix: thread URL path into ScriptBuilder.stopSync (was using empty initialPath)
This commit is contained in:
@@ -106,6 +106,7 @@
|
||||
script = $bindable(),
|
||||
fullyLoaded = true,
|
||||
initialPath = $bindable(''),
|
||||
userDraftPath = '',
|
||||
template = $bindable('script'),
|
||||
initialArgs = {},
|
||||
lockedLanguage = false,
|
||||
@@ -348,10 +349,12 @@
|
||||
// editor with the template's `initialCode` is a programmatic
|
||||
// write that shouldn't count as the user's "first edit" and
|
||||
// shouldn't POST to the server. The route's UserDraft handle is
|
||||
// keyed by `initialPath` (the URL path). Resumed in the async
|
||||
// `.finally` so language switches AFTER bootstrap (which also
|
||||
// call `initContent`) sync normally.
|
||||
UserDraft.stopSync('script', initialPath)
|
||||
// keyed by `userDraftPath` (the URL path), distinct from
|
||||
// `initialPath` which is the editor-displayed path (empty for
|
||||
// new drafts). Resumed in the async `.finally` so language
|
||||
// switches AFTER bootstrap (which also call `initContent`) sync
|
||||
// normally.
|
||||
UserDraft.stopSync('script', userDraftPath)
|
||||
if (template === 'wac_python') {
|
||||
script.modules = {
|
||||
'helper.py': {
|
||||
@@ -368,7 +371,7 @@
|
||||
}
|
||||
}
|
||||
initContent(script.language, script.kind, template).finally(() => {
|
||||
UserDraft.restartSync('script', initialPath)
|
||||
UserDraft.restartSync('script', userDraftPath)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,18 @@ export interface ScriptBuilderProps {
|
||||
disableAi?: boolean
|
||||
fullyLoaded?: boolean
|
||||
initialPath?: string
|
||||
/**
|
||||
* Path the route's `UserDraft.use<EditableScript>('script', ...)`
|
||||
* handle is keyed by. Distinct from `initialPath` for new drafts —
|
||||
* `initialPath` is the displayed/editor path (empty for new), while
|
||||
* this is the URL path the draft is persisted under (`u/{user}/
|
||||
* draft_{uuid}`). Used to bracket the bootstrap `initContent` write
|
||||
* with `UserDraft.stopSync` / `restartSync` so the template seed
|
||||
* doesn't POST before the user's first real edit. Default to `''`
|
||||
* for backwards compat with callers that don't manage drafts; the
|
||||
* stop/restart pair is a no-op on a non-live entry.
|
||||
*/
|
||||
userDraftPath?: string
|
||||
template?:
|
||||
| 'docker'
|
||||
| 'bunnative'
|
||||
|
||||
@@ -344,6 +344,7 @@
|
||||
<ScriptBuilder
|
||||
bind:this={scriptBuilder}
|
||||
{initialPath}
|
||||
userDraftPath={draftPath}
|
||||
bind:script={scriptHandle.draft}
|
||||
{fullyLoaded}
|
||||
bind:savedScript
|
||||
|
||||
Reference in New Issue
Block a user