Comfy-Org / Comfy-Org/ComfyUI_frontend

[DevTask] Use listener/subscriber pattern for node events

Open
#4,739 0 comments 3 reactions 0 assignees View on GitHub
area:litegraph area:vue-migration developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

The current API for node events involves setting a callback as a property of the node. This forces consumers to compete for access to the property namespace, risking inadvertent overwrites or insufficient patching, which can disrupt existing closures. To address this, the node (and widget) events API should be enhanced to use a more reliable pattern such as events/listeners.

In particular, this improvement would improve the ability to register listeners to node lifecycle events, which is becoming increasingly important as the number of scenarios has increased in which objects tied to a node's lifecycle aren't automatically garbage-collected upon node removal—for example, Vue components, floating DOM elements, or Pinia store items keyed to the node.

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-4739-DevTask-Use-listener-subscriber-pattern-for-node-events-2476d73d365081a99aece93544dbe77a) 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.