Comfy-Org / Comfy-Org/ComfyUI_frontend

sendToBack only reorders _nodes; layout store has no send-to-back op, so Vue nodes stacking diverges

Open
#15,754 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
area:ui Potential Bug Public API
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

`LGraphCanvas.sendToBack` ([src/lib/litegraph/src/LGraphCanvas.ts:5018](https://github.com/Comfy-Org/ComfyUI_frontend/blob/00b9a9c64c1e499646b0a6a59fa22dd113d9449c/src/lib/litegraph/src/LGraphCanvas.ts#L5018) at main `00b9a9c64c`) splices `graph._nodes` only. The layout store is never written, and `useLayoutMutations()` has no send-to-back operation at all (`layoutMutations.ts` exposes `bringNodeToFront`/`setNodeZIndex` only).

Vue nodes stacking reads `layout.zIndex` from the layout store (`LGraphNode.vue`), so an extension calling `canvas.sendToBack(node)` changes canvas-renderer draw order but not Vue-nodes stacking. The two renderers diverge on z-order.

Facts at main `00b9a9c64c`:

- `sendToBack` has zero first-party callers. It is a public canvas API, so this is extension-facing, not a first-party repro.
- `bringToFront` (:5004) is the same `_nodes`-only shape, but the Vue path has its own store-backed `bringNodeToFront` (`canvasStore.ts:181` bridges the bring-to-front event; `LGraphNode.vue`, `NodeWidgets.vue`, `useNodeEventHandlers.ts` all call it). No equivalent bridge or op exists for send-to-back.
- Paste already syncs both: `_deserializeItems` assigns fresh `setNodeZIndex` values (:4383-4386).

Fix shape: add a `sendNodeToBack` layout mutation (min zIndex - 1, or renumber) and have `LGraphCanvas.sendToBack`/`bringToFront` write the store like paste does, or bridge them via the same event path as bring-to-front.

Main-scoped: byte-identical at `a08a7598aa` and `00b9a9c64c`; not introduced by #14246. Found during ECS z-order parity review.

_Mirrored from Linear FE-1829._

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.