Skip to content

fix: mask editor save shows blank image due to double-write locator ID mismatch #9983

@dante01yoon

Description

@dante01yoon

Summary

After saving a mask in the mask editor, the Load Image node shows a blank image. Switching to another workflow tab and back fixes it (visual refresh/reactivity bug).

Reported in: Comfy-Org/ComfyUI#12918

Root Cause

In useMaskEditorSaver.ts, updateNodeWithServerReferences uses a fragile double-write pattern:

  1. imageWidget.callback?.(widgetValue) triggers the useImageUploadWidget callback
  2. The callback calls setNodeOutputs(node, annotatedString) where annotatedString = "clipspace/clipspace-painted-masked-xxx.png [input]"
  3. setNodeOutputscreateOutputsparseFilePath keeps [input] in the filename → creates outputs with filename "clipspace-painted-masked-xxx.png [input]" (does not exist on server)
  4. Then updateNodeImages(node) is called to overwrite images with correct node.images
  5. updateNodeImages uses nodeIdToNodeLocatorId(node.id) (depends on activeSubgraph.value), while setNodeOutputs uses nodeToNodeLocatorId(node) (uses node.graph). If these produce different locator IDs, the correction writes to a different key and the broken output remains

Tab switching fixes it because restoreOutputs replaces the entire reactive ref, forcing re-evaluation.

Fix

Replace the double-write with a single correct call to setNodeOutputs using createAnnotatedPath to format the path properly, ensuring consistent locator ID usage and correct filename parsing.

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions