From 517ef2659821f5d42ad1b40ccd3c1c6796d54722 Mon Sep 17 00:00:00 2001 From: Vargha Csongor Date: Wed, 15 May 2024 09:30:50 +0200 Subject: [PATCH] add on mount to solve issues with func call before load --- frontend/src/lib/family_tree/dagreLayout.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/family_tree/dagreLayout.ts b/frontend/src/lib/family_tree/dagreLayout.ts index 1823401..cb38e98 100644 --- a/frontend/src/lib/family_tree/dagreLayout.ts +++ b/frontend/src/lib/family_tree/dagreLayout.ts @@ -1,8 +1,11 @@ import dagre from '@dagrejs/dagre'; import { Position, type Node, type Edge } from '@xyflow/svelte'; +import { onMount } from 'svelte'; const dagreGraph = new dagre.graphlib.Graph(); -dagreGraph.setDefaultEdgeLabel(() => ({})); +onMount(() => { + dagreGraph.setDefaultEdgeLabel(() => ({})); +}); const nodeWidth = 250; const nodeHeight = 250;