From fedb592b92f89aa641134bab33a25f1274bf2f6a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 14 Aug 2024 12:56:45 +0100 Subject: [PATCH] Fix issue where grid styles are not reapplied when component visibility changes --- packages/client/src/components/Component.svelte | 7 +++---- packages/client/src/utils/grid.js | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index e793adff23..69ea0367ab 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -207,8 +207,7 @@ } // Metadata to pass into grid action to apply CSS - let gridMetadata = memo() - $: gridMetadata.set({ + $: gridMetadata = { insideGrid: parent?._component.endsWith("/container") && parent?.layout === "grid", ignoresLayout: definition?.ignoresLayout === true, @@ -218,7 +217,7 @@ draggable, definition, errored: errorState, - }) + } // Update component context $: store.set({ @@ -674,7 +673,7 @@ data-name={name} data-icon={icon} data-parent={$component.id} - use:gridLayout={$gridMetadata} + use:gridLayout={gridMetadata} > {#if errorState} { } // Determine default width and height of component - let width = errored ? 500 : definition.size?.width || 200 - let height = errored ? 60 : definition.size?.height || 200 + let width = errored ? 500 : definition?.size?.width || 200 + let height = errored ? 60 : definition?.size?.height || 200 width += 2 * GridSpacing height += 2 * GridSpacing let vars = {