Auto-save canvas workflow state after every edit#225
Draft
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…lStorage Co-authored-by: Shellishack <40737228+Shellishack@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Save canvas state and workflow after editing
Auto-save canvas workflow state after every edit
Mar 12, 2026
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.
Canvas workflow edits were lost on page reload or app restart — there was no persistence beyond a manual JSON export.
Approach
Adds debounced auto-save (1 s) on every node/edge change, keyed per project. Offline-first via
localStorage; desktop platforms additionally writecanvas.jsoninto the project directory. On next open, the saved state is restored automatically.Changes
AbstractPlatformAPIsaveCanvasState(projectUri, content)andloadCanvasState(projectUri)— default implementation useslocalStorage(offline, cross-platform).nodesandedgesmust be arrays) before being returned.ElectronAPI/CapacitorAPI{projectUri}/canvas.jsonon the local file system.localStoragebase implementation on any error.CloudAPIlocalStoragedefault.useWorkflowPersistence(new hook)EditorContextand delegates toplatformApi.saveCanvasState/loadCanvasState.useCanvasWorkflowuseWorkflowPersistenceand addsdebouncePersistCanvasState(1 s) triggered onlocalNodes/localEdgeschanges.{ nodes, edges }only — per-app snapshot states are excluded to avoid blocking IMC round-trips on every edit.ProjectViewcreateNewCanvasloads any previously saved state before creating the tab; passes it asinitialWorkflowContentso the last layout is restored. Falls back to an empty canvas when no state exists.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.