-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
What happened?
Reproduction
Bug
vueNodesMap in registry.ts is a module-level global object, but register() accepts a per-instance lf parameter. When the same node type is registered for multiple LogicFlow instances (e.g., nested sub-flows), the later register() call overwrites the earlier entry in vueNodesMap.
// registry.ts (current)
export const vueNodesMap = {} // ← global singleton
export function register(config, lf) {
vueNodesMap[type] = { component, effect } // ← global overwrite!
lf.register({ type, view, model }) // ← per-instance (correct)
}lf.register() correctly scopes the Model/View to the specific LogicFlow instance, bu
- Create an outer LogicFlow instance, register node type
A— its Vue component captures context A - Create an inner (nested) LogicFlow instance, register the same type
A— its Vue component captures context B, and overwritesvueNodesMap['A'] - Delete/destroy the inner LogicFlow instance — context B is now stale/empty
- Add a new node of type
Ato the outer LogicFlow - Result: The outer LogicFlow creates the node using the stale component from the destroyed inner instance (context B), instead of the original component (context A)
Concrete scenario
This happens with a Loop Node that embeds a sub-flow (inner LogicFlow). The loop's sub-flow registers the same node types as the outer flow. When the loop node is deleted from the canvas, all new nodes created afterward use the orphaned inner components — breaking rendering (e.g., missing icons, empty slot data).
Expected Behavior
Each LogicFlow instance should maintain its own component mapping, or register() should not overwrite existing entries when called from a nested/child context.
Core Version
2.1.x
Extension Version
1.x.x
Engine Version
No response
What browsers are you seeing the problem on?
No response