Comfy-Org / Comfy-Org/ComfyUI_frontend

Group mode menu mutates node.mode directly instead of dispatching a command batch

Open
#15,369 0 comments 0 reactions 0 assignees View on GitHub
area:groups area:undo-redo Potential Bug
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

Group mode changes from the canvas context menu mutate `node.mode` directly instead of producing a command batch, which ADR 0003 / ADR 0008 require for entity state changes.

```ts
// src/extensions/core/groupOptions.ts
function setNodeMode(node: LGraphNode, mode: LGraphEventMode) {
node.mode = mode
node.graph?.change()
}
```

Each menu callback calls this once per node in the group, so setting the mode on an N-node group emits N separate non-serializable updates. There is no atomic undo, no replay, and nothing transmittable over CRDT — selecting "Bypass Group Nodes" on a 10-node group takes 10 undo steps to reverse.

Wanted: one replayable command batch per menu action, covering every node in the group.

Surfaced by CodeRabbit on #15366 (https://github.com/Comfy-Org/ComfyUI_frontend/pull/15366#discussion_r-groupoptions). It is pre-existing on `main` — #15366 only re-typed the `mode` parameter and collapsed the duplicated menu branches, so fixing it there would have turned a behaviour-preserving refactor into a behaviour change. Split out here instead.

Same pattern likely applies to other bulk node-mode paths (single-node bypass, keybinding-driven mode toggles) — worth checking them in the same pass.

Contributor guide

Open the contributing guide

Research direction

Start in src/extensions/core/groupOptions.ts at setNodeMode and inspect ADR 0003, ADR 0008, and the command-batch patterns used by the menu callbacks. Trace the existing command APIs before changing the group action; done means one replayable, serializable batch covers all selected nodes and supports atomic undo, replay, and CRDT transmission.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.