Skip to content

[Bug Report]: vueNodesMap is a global singleton, causing component overwrite in nested LogicFlow scenarios #2376

@EralChen

Description

@EralChen

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

  1. Create an outer LogicFlow instance, register node type A — its Vue component captures context A
  2. Create an inner (nested) LogicFlow instance, register the same type A — its Vue component captures context B, and overwrites vueNodesMap['A']
  3. Delete/destroy the inner LogicFlow instance — context B is now stale/empty
  4. Add a new node of type A to the outer LogicFlow
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions