Skip to content

[Feature Request]: Comprehensive persistence of all workflow tabs including unsaved changes #4057

@christian-byrne

Description

@christian-byrne

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What would your feature do?

Currently, ComfyUI only persists the active/focused workflow's unsaved changes to localStorage when reloading the page, along with the names of the opened tabs. If users have multiple workflow tabs open with unsaved changes, only the active tab's changes are preserved - and the dirty/unsaved tabs themselves are not even persisted at all (even as just tab titles). Note: saved/non-dirty tabs are persisted as tabs on reload (in local storage) -- they are then just loaded lazily on focus.

This feature would implement comprehensive workspace state persistence similar to VS Code and other modern editors, where ALL open workflows (including unsaved changes) are persisted and restored across browser sessions. This would prevent data loss and improve the multi-workflow editing experience. The implementation might involve a new comprehensive data structure with well-defined schema and validation that specifies all aspect of the "workspace".

Proposed workflow

  1. User opens multiple workflow tabs and makes changes to several of them
  2. User reloads the browser (intentionally or due to crash)
  3. All workflow tabs are restored with their exact state, including unsaved changes in ALL tabs (not just the active one)
  4. User can continue working without losing any progress across any open workflows

Additional information

Technical Context

Based on the codebase analysis:

  • Current implementation in useWorkflowPersistence.ts only persists workflows where isPersisted && \!isModified (line 101)
  • The persistCurrentWorkflow() function only saves the active workflow
  • Need to extend persistence to handle multiple workflow states simultaneously

User Impact

  • Prevents data loss when browser crashes or accidental reloads
  • Improves workflow for users working with multiple workflows simultaneously
  • Aligns with standard behavior of modern code editors
  • Addresses multiple user complaints about lost work (as discussed in team Slack)

Implementation Considerations

  • Storage size limitations of localStorage (typically 5-10MB)
  • Consider implementing storage cleanup for very old unsaved states
  • May need to implement a more sophisticated storage strategy for large workflows
  • Should respect the existing Comfy.Workflow.Persist setting

Related Context

This was discussed in detail by the team, with consensus that implementing comprehensive persistence similar to VS Code would be a valuable improvement. The main blocker has been "relatively low demand relative to implementation difficulty."

Extra Info

See also:

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions