Skip to content

Conversation

@christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented Jul 16, 2025

Sets parentSubgraphNode reference on all promoted widgets (not just DOM widgets) to track their subgraph container. This enables proper positioning and lifecycle management.

Changes:

  • Add parentSubgraphNode property to IBaseWidget interface
  • Set property for all promoted widgets during subgraph initialization
  • Dispatch widget-promoted/widget-unpromoted events
  • Clean up references on widget removal

Frontend can use widget.parentSubgraphNode || widget.node for positioning logic.

christian-byrne and others added 7 commits July 19, 2025 15:45
- Add onPromotedWidgetRemoved callback for symmetry with onPromotedWidgetAdded
- Override removeWidgetByName and ensureWidgetRemoved to trigger removal callback
- Improve onRemoved to call removal callback for all promoted widgets, not just DOM widgets
- Ensure containerNode cleanup happens for widgets that have it set
- Set parentSubgraphNode for ALL promoted widgets (not just DOM widgets)
- Rename containerNode to parentSubgraphNode for better clarity
- Update docstrings to reflect actual behavior
- Rename callbacks to onWidgetPromoted/onWidgetUnpromoted for consistency
- Simplify cleanup logic in onRemoved() method

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add "widget-promoted" and "widget-unpromoted" events to SubgraphEventMap
- Replace onWidgetPromoted/onWidgetUnpromoted callbacks with event dispatch
- Events are dispatched through subgraph.events for consistency

This change makes the widget promotion system consistent with the existing
subgraph event architecture and allows for better decoupling.
@christian-byrne christian-byrne force-pushed the feat/dom-widget-promotion branch from f9a8747 to 80ecd0c Compare July 19, 2025 22:52
- Test parentSubgraphNode property assignment
- Test widget-promoted event dispatch
- Test widget-unpromoted event dispatch
- Test cleanup in onRemoved() method
- Test AbortController error handling
Use @/litegraph imports and proper test helpers
- Document critical import pattern for subgraph tests in CLAUDE.md
- Simplify widget promotion tests to focus on type safety
- All tests now pass without circular dependency issues
- Test that widgets are actually promoted to SubgraphNode
- Test that parentSubgraphNode is set for all widget types
- Test widget-promoted and widget-unpromoted events
- Test cleanup behavior on node removal
- Test multiple widgets and DOM widget promotion
- Fix circular dependency in WidgetPromotion test by using barrel import
- Remove unnecessary property existence tests
- Extract createNodeWithWidget helper for test node setup
- Extract setupPromotedWidget helper for common test flow
- Simplify test code and improve readability
- Remove unnecessary WidgetPromotion.test.ts file
@christian-byrne christian-byrne merged commit 0a8f16f into master Jul 21, 2025
3 of 4 checks passed
@christian-byrne christian-byrne deleted the feat/dom-widget-promotion branch July 21, 2025 01:36
@christian-byrne christian-byrne changed the title [feat] Add containerNode property for DOM widget positioning in subgraphs [feat] Add parentSubgraphNode property for DOM widget positioning in subgraphs Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants