Comfy-Org / Comfy-Org/ComfyUI_frontend
[DevTask] Use listener/subscriber pattern for node events
- 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
Assessment
This issue has not been assessed yet.