Comfy-Org / Comfy-Org/ComfyUI_frontend

refactor: surface collapsed state through NodeEntry to remove implicit data-collapsed DOM coupling in useSlotElementTracking

Open
#10,793 0 comments 0 reactions 1 assignee Claimed by @DrJKL View on GitHub
developer experience
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

In `src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts`, the collapsed-node detection currently reads `nodeEl?.dataset.collapsed != null` directly from the DOM. This creates an invisible contract with the `:data-collapsed="isCollapsed || undefined"` attribute in `LGraphNode.vue`. If the template attribute is ever renamed or removed, the fallback to `clientPosToCanvasPos` silently breaks with no compile-time or test-time signal.

## Proposed solution

Surface the `collapsed` state through `NodeEntry` in `nodeSlotRegistryStore`. The component already calls `ensureNode()` at mount time and could set `entry.collapsed` there. `syncNodeSlotLayoutsFromDOM` would then read `node.collapsed` instead of the DOM attribute, making the coupling explicit and type-safe.

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10641
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10641#discussion_r3011997735
- Requested by: @DrJKL

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10793-refactor-surface-collapsed-state-through-NodeEntry-to-remove-implicit-data-collapsed-3356d73d3650811db212ee4e7bff6f48) 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.