-
Notifications
You must be signed in to change notification settings - Fork 406
Description
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
- User opens multiple workflow tabs and makes changes to several of them
- User reloads the browser (intentionally or due to crash)
- All workflow tabs are restored with their exact state, including unsaved changes in ALL tabs (not just the active one)
- 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.tsonly persists workflows whereisPersisted && \!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.Persistsetting
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:
- Restore all open workflows on load #2238 (important)
- Add autosave feature #3330
- Fix save temporary workflow loop on overwrite #1699
- https://github.com/microsoft/vscode
┆Issue is synchronized with this Notion page by Unito