diff --git a/packages/flow/src/edge.component.ts b/packages/flow/src/edge.component.ts index 0443566e6..5d0dae4fd 100644 --- a/packages/flow/src/edge.component.ts +++ b/packages/flow/src/edge.component.ts @@ -51,6 +51,7 @@ export class FlowEdgeComponent ngOnInit(): void { super.ngOnInit(); + this.getRef().setState(this.context.selected ? EdgeStableState.active : EdgeStableState['']); this.initializeGenerator(); this.getRef().buildPathPoints(this.board, this.element); renderEdge(this.board, this.element, this.getRef().getState()); @@ -97,5 +98,7 @@ export class FlowEdgeComponent ngOnDestroy(): void { super.ngOnDestroy(); + this.edgeGenerator.destroy(); + this.edgeLabelGenerator.destroy(); } } diff --git a/packages/flow/src/generators/edge-label-generator.ts b/packages/flow/src/generators/edge-label-generator.ts index 483995e82..dfb819790 100644 --- a/packages/flow/src/generators/edge-label-generator.ts +++ b/packages/flow/src/generators/edge-label-generator.ts @@ -128,4 +128,10 @@ export class EdgeLabelGenerator extends Generator extends Co ngOnDestroy(): void { super.ngOnDestroy(); this.destroyText(); + this.nodeActiveGenerator.destroy(); } } diff --git a/packages/flow/src/plugins/with-hovering.ts b/packages/flow/src/plugins/with-hovering.ts index f96956323..fe4cf2cee 100644 --- a/packages/flow/src/plugins/with-hovering.ts +++ b/packages/flow/src/plugins/with-hovering.ts @@ -4,7 +4,6 @@ import { FlowEdge } from '../interfaces/edge'; import { getHitEdge, getHitNode, isEdgeDragging, isPlaceholderEdgeInfo, renderEdge, renderRelatedEdges } from '../utils'; import { PlaitCommonElementRef } from '@plait/common'; import { NodeActiveGenerator } from '../generators/node-active.generator'; -import { EdgeState } from '../public-api'; export const withHovering: PlaitPlugin = (board: PlaitBoard) => { const { pointerMove, pointerLeave } = board; @@ -22,7 +21,7 @@ export const withHovering: PlaitPlugin = (board: PlaitBoard) => { hoveredElement = newHitNode; return; } - if (hoveredElement) { + if (hoveredElement && PlaitElement.hasMounted(hoveredElement)) { const selected = isSelectedElement(board, hoveredElement); if (FlowNode.isFlowNodeElement(hoveredElement)) { const elementRef = PlaitElement.getElementRef(hoveredElement);