Skip to content

Auto-save canvas workflow state after every edit#225

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/save-canvas-state-workflow
Draft

Auto-save canvas workflow state after every edit#225
Copilot wants to merge 2 commits intomainfrom
copilot/save-canvas-state-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 12, 2026

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 write canvas.json into the project directory. On next open, the saved state is restored automatically.

Changes

AbstractPlatformAPI

  • New concrete methods saveCanvasState(projectUri, content) and loadCanvasState(projectUri) — default implementation uses localStorage (offline, cross-platform).
  • Loaded state is validated (nodes and edges must be arrays) before being returned.

ElectronAPI / CapacitorAPI

  • Override both methods to write/read {projectUri}/canvas.json on the local file system.
  • Falls back to the localStorage base implementation on any error.

CloudAPI

  • No changes — inherits the localStorage default.

useWorkflowPersistence (new hook)

  • Resolves the project URI from EditorContext and delegates to platformApi.saveCanvasState / loadCanvasState.

useCanvasWorkflow

  • Calls useWorkflowPersistence and adds debouncePersistCanvasState (1 s) triggered on localNodes / localEdges changes.
  • Saves { nodes, edges } only — per-app snapshot states are excluded to avoid blocking IMC round-trips on every edit.

ProjectView

  • createNewCanvas loads any previously saved state before creating the tab; passes it as initialWorkflowContent so the last layout is restored. Falls back to an empty canvas when no state exists.
// Before: always creates a blank canvas
await createCanvasTabView({ viewId: createCanvasViewId() });

// After: restores last saved layout if available
const savedContent = await loadWorkflow();
await createCanvasTabView({
  viewId: createCanvasViewId(),
  appConfigs: savedContent?.nodes
    .filter((n) => n?.data?.config != null)
    .map((n) => n.data.config) ?? [],
  initialWorkflowContent: savedContent ?? undefined,
});
Original prompt

This section details on the original issue you should resolve

<issue_title>Save canvas state and workflow after editing</issue_title>
<issue_description>When edits are made in workflow editor, progress should be saved.

Possible methods:

  • Save with platformAPI (store local copies to allow offline saving)
  • Sync to Pulse Editor Cloud when online.</issue_description>

<agent_instructions>When edits are made in workflow editor, progress should be saved.

Possible methods:

  • Save with platformAPI (store local copies to allow offline saving)
  • Sync to Pulse Editor Cloud when online.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 12, 2026

⚠️ No Changeset found

Latest commit: 99e1dde

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web-editor Ready Ready Preview, Comment Mar 12, 2026 10:24am

Request Review

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save canvas state and workflow after editing

2 participants