Repository navigation
fix: replace the draft when editing ends or a version is restored - #641
Merged
Merged
Conversation
End editing only released the lock, and a version restore only refetched the workflow. The editor refused the fresh server state while the draft was dirty, so the discarded draft stayed on the canvas and autosave wrote it back five seconds later, also over a just-restored version. Both now run through replaceDraft in the persistence hook: it stops autosave and follow-up saves, waits for a save already in flight, runs the server operation and only then drops the draft, so the next sync shows the server state. If the operation fails the draft stays dirty. The dirty-draft confirmation moved into the lifecycle, so the button, the command palette and Ctrl+U all ask before discarding. Fixes #596 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #596
After End editing (confirmed discard) the editor only released the lock, and a version restore only refetched the workflow. The editor refuses fresh server data while the draft is dirty, so the discarded draft stayed on the canvas and autosave wrote it back five seconds later, also over a just-restored version.
replaceDraft(operation)inuseWorkflowPersistence: stops autosave and follow-up saves, waits for a save already in flight, runs the server operation, and only on success drops the draft so the next sync shows the server state. On failure the draft stays dirty.docs/workflow-designer-features.mdmention the behavior.Tests run locally (vitest, on top of #638):
WorkflowEditorPage.test.tsx: two new scenario tests (End editing on a dirty draft; restore over a dirty draft). Both fail without the fix.useWorkflowPersistence.test.tsx: replaceDraft waits for the running save and skips its follow-up; a failed operation keeps the draft dirty.WorkflowDiffModal.test.tsx: restore runs through replaceDraft🤖 Generated with Claude Code