mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-09 08:03:50 +00:00
fix(frontend): don't UserDraft.remove flows while route is still mounted
The /flows/add and /flows/edit routes drive FlowBuilder from a flowStore whose getter reads flowHandle.draft directly. Calling UserDraft.remove synchronously before goto() therefore wiped the in-memory entry, made flowStore.val collapse to emptyFlow(), and tripped UnsavedConfirmationModal against the just-saved value — even though the deploy/save-draft itself succeeded. Drop those explicit removes in onSaveInitial, /add onDeploy, and /edit onDeploy. The empty-path entry self-cleans on unmount via onDestroy ref counting; for the non-empty edit path the next visit's load-time diff will silently overwrite localStorage when the local autosave matches the deployed value. Restore-draft/restore-deployed keep their explicit remove because they navigate to the same route (no modal) and loadFlow immediately rehydrates the handle. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
bbe6767f24
commit
079ebef72b
@@ -174,11 +174,9 @@
|
||||
|
||||
<FlowBuilder
|
||||
onSaveInitial={(e) => {
|
||||
UserDraft.remove('flow', '')
|
||||
goto(`/flows/edit/${e.path}?selected=${e.id}`)
|
||||
}}
|
||||
onDeploy={(e) => {
|
||||
UserDraft.remove('flow', '')
|
||||
goto(`/flows/get/${e.path}?workspace=${$workspaceStore}`)
|
||||
}}
|
||||
onDetails={(e) => {
|
||||
|
||||
@@ -270,7 +270,11 @@
|
||||
{:else}
|
||||
<FlowBuilder
|
||||
onDeploy={(e) => {
|
||||
UserDraft.remove('flow', flowDraftPath)
|
||||
// Don't UserDraft.remove here — the route's flowStore reads the
|
||||
// handle's draft directly, so clearing it before goto would blank
|
||||
// the flow value and trip UnsavedConfirmationModal. The entry's
|
||||
// ref count drops on unmount and the next visit's load-time diff
|
||||
// will silently overwrite localStorage with the deployed value.
|
||||
goto(`/flows/get/${e.path}?workspace=${$workspaceStore}`)
|
||||
}}
|
||||
onDetails={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user