mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 00:02:19 +00:00
fix: synthesize value wrapper on draft-only raw_app response
This commit is contained in:
@@ -191,16 +191,31 @@
|
||||
newPath = ''
|
||||
return
|
||||
}
|
||||
const backendApp = await AppService.getAppByPath({
|
||||
const backendApp = (await AppService.getAppByPath({
|
||||
path: page.params.path ?? '',
|
||||
workspace: $workspaceStore!,
|
||||
getDraft: true,
|
||||
rawApp: true
|
||||
})
|
||||
})) as any
|
||||
if (tok !== loadAppToken) return
|
||||
if (backendApp.is_draft) {
|
||||
sendUserToast('Loaded your saved draft')
|
||||
}
|
||||
// When the backend falls back to `fetch_draft_only` (no deployed
|
||||
// row at this path, only a per-user draft), the response's inner
|
||||
// is the raw draft JSON — flat `{files, runnables, data, summary,
|
||||
// policy, custom_path}`, no `.value` wrapper. The rest of this
|
||||
// loader (and `extractRawApp` below) expects the deployed shape
|
||||
// where those live under `.value`. Synthesize the wrapper here
|
||||
// so both paths are uniform downstream.
|
||||
if (backendApp.is_draft && backendApp.value === undefined) {
|
||||
backendApp.value = {
|
||||
files: backendApp.files ?? {},
|
||||
runnables: backendApp.runnables ?? {},
|
||||
data: backendApp.data
|
||||
}
|
||||
if (backendApp.policy === undefined) backendApp.policy = {}
|
||||
}
|
||||
const backendApp_ = structuredClone(stateSnapshot(backendApp))
|
||||
savedApp = {
|
||||
summary: backendApp_.summary,
|
||||
|
||||
Reference in New Issue
Block a user