mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 00:02:30 +00:00
fix(frontend): snapshot UserDraft proxy before structuredClone in resource save
`states[ws].draft` is now a Svelte $state proxy (it flows through UserDraft's useLocalStorageValue cell). `structuredClone` can't clone a proxy and threw "Failed to execute 'structuredClone' on 'Window'", blocking resource saves. Snapshot to a plain object via `$state.snapshot` before assigning the dirty baseline.
This commit is contained in:
@@ -299,8 +299,11 @@
|
||||
})
|
||||
}
|
||||
// Saved on the backend — drop the local autosave for this
|
||||
// workspace and refresh the dirty baseline.
|
||||
initialStates[ws] = structuredClone(s)
|
||||
// workspace and refresh the dirty baseline. `s` is the
|
||||
// UserDraft handle's draft, a Svelte $state proxy;
|
||||
// `structuredClone` can't clone a proxy, so snapshot it to a
|
||||
// plain object first.
|
||||
initialStates[ws] = $state.snapshot(s) as ResourceState
|
||||
UserDraft.remove('resource', initialPath ?? '', { workspace: ws })
|
||||
}
|
||||
sendUserToast(
|
||||
|
||||
Reference in New Issue
Block a user