Improve snapshot reliability and usability
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<p align="center">
|
||||
<a href="https://registry.comfy.org/publishers/ethanfel/nodes/comfyui-snapshot-manager"><img src="https://img.shields.io/badge/ComfyUI-Registry-blue?logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTEyIDJMMyA3djEwbDkgNSA5LTVWN2wtOS01eiIgZmlsbD0id2hpdGUiLz48L3N2Zz4=" alt="ComfyUI Registry"/></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License"/></a>
|
||||
<img src="https://img.shields.io/badge/version-3.0.1-blue" alt="Version"/>
|
||||
<img src="https://img.shields.io/badge/version-3.1.0-blue" alt="Version"/>
|
||||
<img src="https://img.shields.io/badge/ComfyUI-Extension-purple" alt="ComfyUI Extension"/>
|
||||
</p>
|
||||
|
||||
@@ -19,11 +19,12 @@
|
||||
|
||||
## Features
|
||||
|
||||
- **Auto-capture** — Snapshots are saved automatically as you edit, with configurable debounce
|
||||
- **Quieter auto-capture** — Meaningful edits are saved after a debounce and a configurable minimum interval; layout-only changes wait for the next real checkpoint
|
||||
- **Truthful save status** — The sidebar says whether the graph is saved, pending, layout-only, paused, loading, or failed
|
||||
- **Custom naming** — Name your snapshots when taking them manually ("Before merge", "Working v2", etc.); double-click a snapshot's name in the sidebar to rename it later
|
||||
- **Notes** — Attach a freeform note to any snapshot with the note (pencil) button; notes are searchable from the filter bar
|
||||
- **Search & filter** — Quickly find snapshots by name or note with the filter bar
|
||||
- **Restore or Swap** — Open a snapshot as a new workflow, or replace the current one in-place
|
||||
- **Open Copy or Replace** — Open a snapshot in a separate workflow tab, or replace the current tab after a verified return point is saved
|
||||
- **Workflow browser** — Browse and recover snapshots from any workflow, including renamed or deleted ones
|
||||
- **Per-workflow storage** — Each workflow has its own independent snapshot history
|
||||
- **Theme-aware UI** — Adapts to light and dark ComfyUI themes
|
||||
@@ -31,14 +32,14 @@
|
||||
- **SaveSnapshot node** — Trigger snapshot captures from your workflow with a custom node; node snapshots are visually distinct (purple border + "Node" badge) and have their own rolling limit
|
||||
- **Change-type icons** — Timeline markers show what kind of change each snapshot represents (node add, remove, connection, parameter, move, mixed) with distinct colored icons — like Fusion 360's operation timeline
|
||||
- **Timeline bar** — Optional centered floating bar on the canvas showing all snapshots as iconic markers, with a Snapshot button for quick captures; tucks behind the sidebar when open
|
||||
- **Active & current markers** — When you swap to a snapshot, the timeline highlights where you came from (green dot) and where you are (white ring)
|
||||
- **Auto-save before swap** — Swapping to an older snapshot automatically saves your current state first, so you can always get back; browsing between saved snapshots skips redundant saves
|
||||
- **Active & return markers** — After replacing the graph, the timeline highlights the loaded snapshot (white ring) and the return point (green dot)
|
||||
- **Verified return point** — Replace/Open Copy abort if the current graph cannot be protected first
|
||||
- **Ctrl+S shortcut** — Press Ctrl+S (or Cmd+S on Mac) to take a manual snapshot alongside ComfyUI's own save
|
||||
- **SVG graph previews** — Hover any snapshot for a tooltip preview of the workflow graph; click the eye button for a full-size modal; diff view now shows side-by-side SVG comparison with color-coded highlights (green = added, red = removed, amber = modified)
|
||||
- **Diff view** — Compare any snapshot against the current workflow (one click) or two snapshots against each other (Shift+click to set base); see added/removed/modified nodes, widget value changes, and rewired connections in a single modal
|
||||
- **Profile manager** — Save and load named sets of workflows as session profiles (like browser tab groups); profiles track which workflows you visited and restore the latest snapshot for each
|
||||
- **Hide auto-saves** — Toggle button next to the search bar hides auto-save snapshots to reduce clutter while keeping manual, locked, and node-triggered snapshots visible
|
||||
- **Pause auto-capture** — Toggle automatic capture on/off for the session without leaving the panel (Auto: On/Off button in the filter row)
|
||||
- **Profile manager** — Save and load named sets of workflows as session profiles; new profiles pin exact snapshot IDs so their contents do not drift
|
||||
- **Hide auto-saves** — The persistent filter hides auto history while keeping manual, locked, return-point, and node-triggered snapshots visible
|
||||
- **Pause auto-capture** — Pause/resume from the panel; pausing cancels any pending timer and stays synchronized with the setting
|
||||
- **Export / Import** — Download a workflow's full snapshot history as a JSON file and re-import it on another machine or server
|
||||
- **Storage usage** — The sidebar footer shows total snapshot storage used on the server across all workflows
|
||||
- **Retention by age** — Optionally auto-delete snapshots older than a configurable number of days (off by default), alongside the per-workflow count limit
|
||||
@@ -70,7 +71,9 @@ Click the **clock icon** (<img src="https://img.shields.io/badge/-pi pi--history
|
||||
|
||||
### 2. Snapshots are Captured Automatically
|
||||
|
||||
As you edit your workflow, snapshots are saved automatically after a configurable delay (default: 3 seconds). An initial snapshot is also captured when the workflow loads.
|
||||
As you edit, meaningful changes are saved after a short quiet period (default: 3 seconds), with at least 60 seconds between automatic snapshots by default. Repositioning or resizing nodes alone does not create an entry; that layout rides with the next meaningful or manual checkpoint. An initial snapshot is created only when a workflow has no history.
|
||||
|
||||
The status line at the top of the sidebar always describes the live graph: saved, pending, layout-only, paused, loading, or failed.
|
||||
|
||||
### 3. Take a Named Snapshot
|
||||
|
||||
@@ -80,16 +83,15 @@ Click **Take Snapshot** to manually save the current state. A prompt lets you en
|
||||
|
||||
Use the filter bar at the top of the panel to search snapshots by name. The clear button (**×**) resets the filter.
|
||||
|
||||
### 5. Restore or Swap
|
||||
### 5. Open Copy or Replace
|
||||
|
||||
Each snapshot has action buttons:
|
||||
|
||||
| Button | Action |
|
||||
|--------|--------|
|
||||
| **Preview** (eye icon) | Opens a full-size SVG preview of the workflow graph |
|
||||
| **Lock** | Toggles lock protection (padlock icon) |
|
||||
| **Swap** | Replaces the current workflow in-place (same tab) |
|
||||
| **Restore** | Opens the snapshot as a new workflow |
|
||||
| **Open Copy** | Opens the snapshot in a separate workflow tab |
|
||||
| **Replace** | Replaces the graph in the current tab after saving a return point |
|
||||
| **More (…)** | Preview, Diff, Add/Edit Note, Lock/Unlock, and Delete |
|
||||
|
||||
### 6. Lock / Pin Snapshots
|
||||
|
||||
@@ -132,15 +134,15 @@ Additional marker styles are layered on top of the change-type icon:
|
||||
| **Purple background** | Node-triggered snapshot (overrides change-type color) |
|
||||
| **Yellow border** | Locked snapshot |
|
||||
| **White ring (larger)** | Active — the snapshot you swapped TO |
|
||||
| **Green background** | Current — your auto-saved state before the swap |
|
||||
| **Green background** | Return point — the protected state from before Replace/Open Copy |
|
||||
|
||||
Click any marker to swap to that snapshot. Hover to see a tooltip with the snapshot name, time, and change description. The **Snapshot** button on the right takes a quick manual snapshot. The bar is centered at 80% width to clear both the sidebar icon strip and bottom-right controls, and tucks behind the sidebar panel when it's open.
|
||||
Click any marker to replace the current graph with that snapshot. Hover to see a tooltip with the snapshot name, time, and change description. The **Snapshot** button on the right takes a quick manual snapshot. The bar is centered at 80% width to clear both the sidebar icon strip and bottom-right controls, and tucks behind the sidebar panel when it's open.
|
||||
|
||||
The sidebar list also shows the change type in the meta line below each snapshot (e.g., "5 nodes · Parameters changed").
|
||||
|
||||
### 9. Auto-save Before Swap
|
||||
### 9. Return Point Before Replace
|
||||
|
||||
When you swap to an older snapshot (via the sidebar or timeline), the extension automatically captures a "Current" snapshot of your work-in-progress first. This green-marked snapshot appears on the timeline so you can click it to get back. The marker disappears once you edit the graph (since auto-capture creates a proper snapshot at that point). Browsing between existing snapshots does not create additional "Current" entries — the auto-save only triggers on the first swap away from unsaved work.
|
||||
Before Open Copy or Replace changes workflow navigation, the extension saves a typed **Return point** of your current graph. If that write fails, the requested action is cancelled. The green timeline marker identifies the return point; the white ring identifies the loaded snapshot.
|
||||
|
||||
### 10. Keyboard Shortcut
|
||||
|
||||
@@ -169,6 +171,7 @@ The diff modal shows:
|
||||
| **Removed Nodes** | Nodes present in the base but not the target |
|
||||
| **Modified Nodes** | Nodes with changed position, size, title, mode, widget values, or properties — each change shown as old (red strikethrough) → new (green) |
|
||||
| **Link Changes** | Added/removed connections with node names and slot indices |
|
||||
| **Group Changes** | Added, removed, renamed, moved, or restyled graph groups |
|
||||
|
||||
Sections are collapsible (click the header to toggle). If the two snapshots are identical, a "No differences found." message is shown. Dismiss the modal with **Escape**, the **X** button, or by clicking outside.
|
||||
|
||||
@@ -184,9 +187,9 @@ The SVG renderer draws nodes with their stored position, size, and colors. Links
|
||||
|
||||
### 14. Hide Auto-saves
|
||||
|
||||
Click the **Hide Auto** button next to the search bar to hide all auto-save snapshots ("Auto" and "Initial"). The button turns blue and switches to **Show Auto** when active.
|
||||
Click the **Hide Auto** button next to the search bar to hide all auto-save snapshots ("Auto" and "Initial"). The choice persists when the sidebar or ComfyUI is reopened. The button turns blue and switches to **Show Auto** when active.
|
||||
|
||||
The filter works together with text search — both are applied simultaneously. Manual, locked, node-triggered, and "Current" snapshots are always shown.
|
||||
The filter works together with text search — both are applied simultaneously. Manual, locked, node-triggered, and return-point snapshots are always shown.
|
||||
|
||||
### 15. Session Profiles
|
||||
|
||||
@@ -201,15 +204,13 @@ Save and load named sets of workflows — like browser tab groups for ComfyUI.
|
||||
**Load a profile:**
|
||||
|
||||
1. Expand the Profiles section
|
||||
2. Click **Load** on any profile — the extension fetches the latest snapshot for each workflow and loads them via `loadGraphData`
|
||||
2. Click **Load** on any profile — the extension opens the exact snapshot saved for each workflow (legacy profiles fall back to the latest snapshot)
|
||||
3. The profile's active workflow is loaded last so it ends up visible
|
||||
4. A toast reports how many workflows were loaded and how many were skipped (missing snapshots)
|
||||
|
||||
**Delete a profile:** Click **X** on any profile (with confirmation).
|
||||
|
||||
Profiles are stored as JSON files on the server at `<extension_dir>/data/profiles/`.
|
||||
|
||||
> **Note:** ComfyUI's `loadGraphData` replaces the current workflow — there is no API to open new tabs. Each loaded workflow overwrites the previous one. The user ends up seeing the last loaded workflow (the active one). Previously loaded workflows may appear in ComfyUI's workflow history/tabs depending on the frontend version.
|
||||
Profiles are stored as JSON files on the server at `<user_dir>/snapshot_manager/profiles/`.
|
||||
|
||||
## Settings
|
||||
|
||||
@@ -219,10 +220,12 @@ All settings are available in **ComfyUI Settings > Snapshot Manager**:
|
||||
|---------|------|---------|-------------|
|
||||
| **Auto-capture on edit** | Toggle | `On` | Automatically save snapshots when the workflow changes |
|
||||
| **Capture delay** | Slider | `3s` | Seconds to wait after the last edit before auto-capturing (1–30s) |
|
||||
| **Minimum time between auto-snapshots** | Slider | `60s` | Prevent rapid edits from producing a wall of automatic entries (0–300s) |
|
||||
| **Max snapshots per workflow** | Slider | `50` | Maximum number of unlocked snapshots kept per workflow (5–200). Oldest unlocked are pruned automatically; locked snapshots are never pruned |
|
||||
| **Capture on workflow load** | Toggle | `On` | Save an "Initial" snapshot when a workflow is first loaded |
|
||||
| **Initial snapshot for new workflows** | Toggle | `On` | Save an "Initial" snapshot only when the workflow has no history |
|
||||
| **Max node-triggered snapshots** | Slider | `5` | Rolling limit for SaveSnapshot node captures per workflow (1–50). Node snapshots are pruned independently from auto/manual snapshots |
|
||||
| **Show snapshot timeline** | Toggle | `Off` | Display a timeline bar at the bottom of the canvas with snapshot markers, active/current indicators, and a quick Snapshot button |
|
||||
| **Auto-delete by age** | Slider | `0` | Delete old unlocked snapshots after this many days; 0 disables age pruning |
|
||||
| **Show snapshot timeline** | Toggle | `Off` | Display a timeline bar with snapshot markers, active/return-point indicators, and a quick Snapshot button |
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -233,12 +236,12 @@ All settings are available in **ComfyUI Settings > Snapshot Manager**:
|
||||
**Auto/manual capture flow:**
|
||||
|
||||
1. **Graph edits** trigger a `graphChanged` event
|
||||
2. A **debounce timer** prevents excessive writes
|
||||
3. The workflow is serialized and **hash-checked** against the last capture (per-workflow) to avoid duplicates
|
||||
2. A **debounce and minimum interval** prevent bursty writes; pausing cancels a pending timer
|
||||
3. The workflow is serialized and **structurally compared** against the last capture to avoid duplicate and layout-only auto history
|
||||
4. The previous graph state is diffed against the current to **detect the change type** (node add/remove, connection, parameter, move, or mixed) — stored as a `changeType` field on the record
|
||||
5. New snapshots are sent to the **server** and stored as individual JSON files under `<user_dir>/snapshot_manager/snapshots/`
|
||||
6. The **sidebar panel** and **timeline bar** fetch snapshots from the server and render them with change-type icons
|
||||
7. **Restore/Swap** loads graph data back into ComfyUI with a lock guard to prevent concurrent operations, and updates the graph cache so the next diff is accurate
|
||||
7. **Open Copy/Replace** first verifies a return-point write, then loads graph data with a lock guard and resets the live comparison baseline
|
||||
|
||||
**Node-triggered capture flow:**
|
||||
|
||||
@@ -247,13 +250,13 @@ All settings are available in **ComfyUI Settings > Snapshot Manager**:
|
||||
3. The snapshot is saved with `source: "node"` and pruned against its own rolling limit (`maxNodeSnapshots`)
|
||||
4. Node snapshots appear in the sidebar with a **purple left border** and **"Node" badge**
|
||||
|
||||
**Swap with auto-save:**
|
||||
**Replace with a return point:**
|
||||
|
||||
1. User clicks **Swap** (sidebar or timeline marker)
|
||||
2. If the current graph is unsaved work (not already a swapped snapshot), `captureSnapshot("Current")` saves it **before** the swap — browsing between existing snapshots skips this step
|
||||
1. User clicks **Replace** (sidebar or timeline marker)
|
||||
2. `captureSnapshot("Return point")` completes **before** the graph is changed; failure aborts the action
|
||||
3. The target snapshot is loaded into the graph
|
||||
4. The **timeline** updates: the swapped-to snapshot gets a white ring (active), the auto-saved snapshot gets a green dot (current)
|
||||
5. Clicking the green dot swaps back; editing the graph clears both markers (the next auto-capture supersedes them)
|
||||
4. The **timeline** updates: the loaded snapshot gets a white ring and the return point gets a green dot
|
||||
5. Clicking the green dot replaces the graph with the protected return point
|
||||
|
||||
**Branching** (implemented but disabled in the current release — the code remains for a future enable):
|
||||
|
||||
@@ -265,8 +268,8 @@ All settings are available in **ComfyUI Settings > Snapshot Manager**:
|
||||
**Profiles:**
|
||||
|
||||
1. Session tracking records each visited workflow key with timestamps
|
||||
2. **Save** creates a JSON file at `<user_dir>/snapshot_manager/profiles/<id>.json` with the workflow list and active workflow
|
||||
3. **Load** fetches the latest snapshot for each workflow in the profile and calls `loadGraphData`
|
||||
2. **Save** records the exact snapshot ID for each workflow plus the active workflow
|
||||
3. **Load** opens those pinned snapshots in workflow tabs; legacy profiles without IDs use the latest available snapshot
|
||||
|
||||
**Storage:** Snapshots are stored as JSON files on the server in ComfyUI's user directory at `<user_dir>/snapshot_manager/snapshots/<workflow_key>/<id>.json`. Profiles are stored at `<user_dir>/snapshot_manager/profiles/<id>.json`. Data from older versions (kept under the extension's own `data/` folder) is migrated here automatically on first load. Both persist across browser sessions, ComfyUI restarts, and are accessible from any browser connecting to the same server.
|
||||
|
||||
@@ -279,16 +282,16 @@ On the server's filesystem in ComfyUI's user directory under `snapshot_manager/s
|
||||
On first load after upgrading, the extension automatically migrates all snapshots from your browser's IndexedDB to the server. Once migration succeeds, the old IndexedDB database is deleted. If migration fails (e.g., server unreachable), your old data is preserved and migration will retry on the next load.
|
||||
|
||||
**Will this slow down ComfyUI?**
|
||||
No. Snapshots are captured asynchronously after a debounce delay. The hash check prevents redundant writes.
|
||||
Snapshots are captured asynchronously after a debounce and minimum interval. Structural comparison prevents duplicate and layout-only automatic writes.
|
||||
|
||||
**What happens if I switch workflows?**
|
||||
Each workflow has its own snapshot history. Switching workflows cancels any pending captures and shows the correct snapshot list. You can also browse snapshots from other workflows using the workflow picker.
|
||||
Each workflow has its own snapshot history. If an edit is still waiting on its debounce when you switch, that graph is frozen and queued under the workflow you left, then the sidebar follows the new workflow. You can browse other histories with the workflow picker.
|
||||
|
||||
**I renamed/deleted a workflow — are my snapshots gone?**
|
||||
No. Snapshots are keyed by the workflow name at capture time. Use the workflow picker to find and restore them under the old name.
|
||||
|
||||
**What are profiles?**
|
||||
Profiles save a list of workflows you've visited in a session. Loading a profile restores the latest snapshot for each workflow. They're useful for switching between project contexts — like browser tab groups.
|
||||
Profiles save exact snapshots for workflows visited in a session. Loading a profile opens those pinned states, so a profile does not change merely because newer autosaves were created later.
|
||||
|
||||
**Can I use this with ComfyUI Manager?**
|
||||
Yes — install via ComfyUI Manager or clone the repo into `custom_nodes/`.
|
||||
|
||||
Reference in New Issue
Block a user