Comfy-Org / Comfy-Org/ComfyUI_frontend

Centralize preview promotion logic for subgraph nodes

Open
#10,718 0 comments 0 reactions 1 assignee Claimed by @jtydhr88 View on GitHub
area:previews area:subgraph developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Currently, `src/renderer/glsl/useGLSLPreview.ts` (introduced in PR #10349) contains inline logic to detect whether an inner node inside a subgraph has execution output and then promote that preview to the outer subgraph node. This logic should ideally live in a centralized preview-promotion system that works across **all** node types with outputs/previews — not just GLSL nodes.

## Background

In PR #10349, the composable `useGLSLPreview` checks `hasExecutionOutput` by inspecting both the direct node locator and the inner GLSL node locator inside a subgraph. This is a workable solution for GLSL nodes, but the same pattern would need to be duplicated for any future node type that has an inner subgraph node producing previews.

## Proposed Work

- Identify the centralized system responsible for promoting previews to subgraph nodes (e.g., `nodeOutputStore`, `usePromotedPreviews`, or a new composable/store).
- Move the subgraph-inner-node → outer-subgraph-node preview promotion logic into that centralized system so it applies universally.
- Verify that GLSL live preview and other preview types continue to work correctly after the refactor.
- Remove the inline subgraph preview check from `useGLSLPreview` once the centralized system handles it.

## References

- PR #10349: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10349
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10349#discussion_r3005206125
- Requested by: @christian-byrne

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10718-Centralize-preview-promotion-logic-for-subgraph-nodes-3326d73d3650812c86dbef2c5075600e) by [Unito](https://www.unito.io)

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.