Comfy-Org / Comfy-Org/ComfyUI_frontend

Reduce preview composable invalidations for non-subgraph Vue nodes

Open
#15,679 0 comments 0 reactions 1 assignee Claimed by @christian-byrne View on GitHub
area:previews area:vue-migration perf:speed
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Reduce unnecessary reactive evaluations from preview composables in Vue graph nodes.

`LGraphNode.vue` currently instantiates both `usePromotedPreviews` and `useAmbientSubgraphPreviews` for every `LGraphNode`. For non-subgraph nodes, these composables short-circuit. However, preview output updates can still invalidate their computed state across all Vue nodes.

## Rationale

Large workflows can contain 500 or more nodes but few subgraph nodes. A WebSocket preview frame can cause O(total nodes) short-circuit evaluations. The new ambient-preview path has the same subscription pattern as the existing promoted-preview path. Address both paths together in a dedicated performance change.

## Affected areas

- `src/renderer/extensions/vueNodes/components/LGraphNode.vue`
- `usePromotedPreviews`
- `useAmbientSubgraphPreviews`
- Reactive dependencies on node output / preview state

## Required changes

- Determine a design that prevents non-subgraph `LGraphNode` instances from subscribing to preview-output changes.
- Apply the design consistently to both promoted previews and ambient previews.
- Preserve preview behavior, ordering, and exposure precedence for `SubgraphNode` instances.
- Keep this work separate from pull request #14569.

## Acceptance criteria

- Non-subgraph Vue nodes do not perform preview-composable recomputation for unrelated preview frames.
- Subgraph nodes continue to render promoted and ambient previews correctly.
- An explicit exposure continues to take precedence over an ambient preview for the same source node.
- Add or update focused tests where the existing test structure supports this behavior.

## Backlinks

- Source pull request: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14569
- Source review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/14569#discussion_r3798717729
- Requested by: @christian-byrne

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.