From d1662f1703ef46ed98a2367d6398427b32d54d56 Mon Sep 17 00:00:00 2001
From: Peter
Date: Wed, 25 Oct 2023 09:31:04 +0200
Subject: [PATCH 1/2] fix(svelte) resizing updates width & height in the store
correctly
---
.../svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte b/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte
index d9eb867d..cfa66d67 100644
--- a/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte
+++ b/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte
@@ -106,6 +106,12 @@
};
});
+ // Update width & height on resize
+ $: {
+ store.width.set(clientWidth);
+ store.height.set(clientHeight);
+ }
+
// this updates the store for simple changes
// where the prop names equals the store name
$: {
From bbdff5ab10be24bb67a54816a9d60204998da953 Mon Sep 17 00:00:00 2001
From: moklick
Date: Mon, 30 Oct 2023 11:14:10 +0100
Subject: [PATCH 2/2] chore(svelte): prevent undefined for width and height
---
.../svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte b/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte
index cfa66d67..36209b17 100644
--- a/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte
+++ b/packages/svelte/src/lib/container/SvelteFlow/SvelteFlow.svelte
@@ -108,8 +108,10 @@
// Update width & height on resize
$: {
- store.width.set(clientWidth);
- store.height.set(clientHeight);
+ if (clientWidth !== undefined && clientHeight !== undefined) {
+ store.width.set(clientWidth);
+ store.height.set(clientHeight);
+ }
}
// this updates the store for simple changes