Comfy-Org / Comfy-Org/ComfyUI_frontend
Refactor useGLSLPreview: split normal GLSLShader node and subgraph node logic into separate composables
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
In `src/renderer/glsl/useGLSLPreview.ts`, much of the logic branches internally between two cases:
- A **direct `GLSLShader` node** (normal case)
- A **`SubgraphNode` containing an inner `GLSLShader`** (subgraph case)
This branching is spread across multiple helpers and the main composable body, making the code harder to follow and maintain.
## Proposed Refactor
Consider decomposing `useGLSLPreview` into two focused composables:
- `useGLSLDirectPreview` — handles the direct `GLSLShader` node path
- `useGLSLSubgraphPreview` — handles the subgraph wrapper path
A thin coordinator composable (`useGLSLPreview`) would detect node type and delegate to the appropriate implementation. The two-tier outer/inner `effectScope` pattern can be preserved.
A recent refactor commit already extracted uniforms and utils into separate files, which is a good start. This issue tracks the remaining normal-vs-subgraph split.
## Context
- Raised as a non-blocking nit in PR #10349: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10349#discussion_r3005204366
- Requested by @christian-byrne for a followup PR on a future date.
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10717-Refactor-useGLSLPreview-split-normal-GLSLShader-node-and-subgraph-node-logic-into-se-3326d73d3650818cbdb4f54443a4f6e8) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.