mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-05 00:03:08 +00:00
fix: tolerate missing latest-version on draft-only flow reload
This commit is contained in:
@@ -190,13 +190,24 @@
|
||||
return
|
||||
}
|
||||
// Currently there is no way to get version of flow with flow.
|
||||
// So we have to request it here
|
||||
const v = (
|
||||
await FlowService.getFlowLatestVersion({
|
||||
workspace: $workspaceStore!,
|
||||
path: page.params.path ?? ''
|
||||
})
|
||||
).id
|
||||
// So we have to request it here.
|
||||
//
|
||||
// Tolerate a missing version: when the path is draft-only (no
|
||||
// deployed flow at this path), `getFlowLatestVersion` returns no
|
||||
// row and `.id` would throw on `null`. The `getFlowByPath` call
|
||||
// below still returns the draft via the `get_draft` overlay, so
|
||||
// the editor can mount with `version = undefined`.
|
||||
let v: number | undefined
|
||||
try {
|
||||
v = (
|
||||
await FlowService.getFlowLatestVersion({
|
||||
workspace: $workspaceStore!,
|
||||
path: page.params.path ?? ''
|
||||
})
|
||||
)?.id
|
||||
} catch {
|
||||
v = undefined
|
||||
}
|
||||
if (tok !== loadFlowToken) return
|
||||
version = v
|
||||
|
||||
|
||||
Reference in New Issue
Block a user