{#if otherDirty.length > 0}
diff --git a/frontend/src/lib/components/ScriptBuilder.svelte b/frontend/src/lib/components/ScriptBuilder.svelte
index 8f4e75ff3d..ee003ede11 100644
--- a/frontend/src/lib/components/ScriptBuilder.svelte
+++ b/frontend/src/lib/components/ScriptBuilder.svelte
@@ -696,15 +696,7 @@
sendUserToast(`Could not parse code, are you sure it is valid?`, true)
}
let newHash = ''
- if (initialPath == '' || savedScript?.draft_only) {
- if (savedScript?.draft_only) {
- await ScriptService.deleteScriptByPath({
- workspace: $workspaceStore!,
- path: initialPath,
- keepCaptures: true
- })
- script.parent_hash = undefined
- }
+ if (initialPath == '') {
if (!initialPath || script.path != initialPath) {
await CaptureService.moveCapturesAndConfigs({
workspace: $workspaceStore!,
@@ -727,7 +719,6 @@
language: script.language,
kind: script.kind,
tag: script.tag,
- draft_only: true,
envs: script.envs,
concurrent_limit: script.concurrent_limit,
concurrency_time_window_s: script.concurrency_time_window_s,
@@ -762,7 +753,7 @@
await DraftService.createDraft({
workspace: $workspaceStore!,
requestBody: {
- path: initialPath == '' || savedScript?.draft_only ? script.path : initialPath,
+ path: initialPath == '' ? script.path : initialPath,
typ: 'script',
value: {
...script,
@@ -773,9 +764,7 @@
const clonedScript = structuredClone($state.snapshot(script))
savedScript = {
- ...(initialPath == '' || savedScript?.draft_only
- ? { ...clonedScript, draft_only: true }
- : savedScript),
+ ...(initialPath == '' ? clonedScript : savedScript),
draft: {
...clonedScript,
draft_triggers: draftTriggers
@@ -783,7 +772,7 @@
} as NewScriptWithDraftAndDraftTriggers
let savedAtNewPath = false
- if (initialPath == '' || (savedScript?.draft_only && script.path !== initialPath)) {
+ if (initialPath == '') {
savedAtNewPath = true
initialPath = script.path
onSaveInitial?.({ path: script.path, hash: newHash })
@@ -862,10 +851,7 @@
: [])
]
: []),
- ...(!inSessionPane &&
- !script.draft_only &&
- script.kind === 'script' &&
- !script.auto_kind
+ ...(!inSessionPane && script.kind === 'script' && !script.auto_kind
? [
{
label: 'Exit & See details',
@@ -1960,7 +1946,7 @@
{hasPreprocessor}
canHavePreprocessor={canHavePreprocessor(script.language)}
args={hasPreprocessor && selectedInputTab !== 'preprocessor' ? {} : args}
- isDeployed={savedScript && !savedScript?.draft_only}
+ isDeployed={!!savedScript}
schema={script.schema}
runnableVersion={script.parent_hash}
onDeployTrigger={handleDeployTrigger}
@@ -2122,7 +2108,7 @@
{template}
tag={script.tag}
lastSavedCode={savedScript?.draft?.content}
- lastDeployedCode={savedScript?.draft_only ? undefined : savedScript?.content}
+ lastDeployedCode={savedScript?.content}
bind:args
bind:hasPreprocessor
bind:captureTable
diff --git a/frontend/src/lib/components/VariableEditor.svelte b/frontend/src/lib/components/VariableEditor.svelte
index 2421738fb4..d9a234ea1b 100644
--- a/frontend/src/lib/components/VariableEditor.svelte
+++ b/frontend/src/lib/components/VariableEditor.svelte
@@ -16,8 +16,7 @@
import { deepEqual } from 'fast-equals'
import { getUserExt } from '$lib/user'
import type { UserExt } from '$lib/stores'
- import { UserDraft, checkStaleness, type UserDraftHandle } from '$lib/userDraft.svelte'
- import LocalDraftStaleModal from './common/confirmationModal/LocalDraftStaleModal.svelte'
+ import { UserDraft, type UserDraftHandle } from '$lib/userDraft.svelte'
import LocalDraftBanner from './LocalDraftBanner.svelte'
const dispatch = createEventDispatcher()
@@ -48,37 +47,6 @@
// no DB-draft concept, so only `remoteRev` is ever populated.
let fetchedRev: Record
= $state({})
- // Local-draft staleness modal: opened when the backend variable moved
- // on (someone else edited it) since the local autosave was written.
- let staleModalOpen = $state(false)
- let pendingStale: { ws: string; backend: VariableState } | undefined = undefined
-
- function onStaleLoadLatest(): void {
- if (!pendingStale) {
- staleModalOpen = false
- return
- }
- const { ws, backend } = pendingStale
- UserDraft.discard('variable', editPath ?? '', backend, { workspace: ws })
- initialStates[ws] = $state.snapshot(backend) as VariableState
- pendingStale = undefined
- staleModalOpen = false
- }
-
- function onStaleKeepDraft(): void {
- if (pendingStale) {
- const { ws } = pendingStale
- UserDraft.saveMeta(
- 'variable',
- editPath ?? '',
- { remoteRev: fetchedRev[ws] },
- { workspace: ws }
- )
- }
- pendingStale = undefined
- staleModalOpen = false
- }
-
const handlesArray = UserDraft.useMany(() =>
workspaceSpecs.map((s) => ({
itemKind: 'variable' as const,
@@ -173,23 +141,6 @@
labels: v.labels ?? undefined,
wsSpecific: v.ws_specific ?? false
}
- // See ResourceEditor for the same pattern: a backend that
- // moved on since the autosave was written → staleness modal;
- // otherwise just a "showing your local autosave" toast with
- // a "Reset to deployed" escape.
- const persisted = UserDraft.get('variable', p, { workspace: ws })
- const previousMeta = UserDraft.getMeta('variable', p, { workspace: ws })
- if (persisted !== undefined && !deepEqual(persisted, s)) {
- const cause = checkStaleness(previousMeta, v.edited_at)
- if (cause) {
- pendingStale = { ws, backend: s }
- staleModalOpen = true
- } else {
- if (previousMeta.remoteRev === undefined && previousMeta.remoteDraftRev === undefined) {
- UserDraft.saveMeta('variable', p, { remoteRev: v.edited_at }, { workspace: ws })
- }
- }
- }
ensureHandle(ws, s)
initialStates[ws] = structuredClone(s)
existedInitially[ws] = true
@@ -315,13 +266,6 @@
}
-
-
{
appReportingDrawerOpen = true
},
- disabled: !savedApp || savedApp.draft_only
+ disabled: !savedApp
},
{
displayName: 'Diff',
@@ -905,7 +876,7 @@