Fix issue where grid styles are not reapplied when component visibility changes

This commit is contained in:
Andrew Kingston 2024-08-14 12:56:45 +01:00
parent 84db937cba
commit fedb592b92
No known key found for this signature in database
2 changed files with 5 additions and 6 deletions

View File

@ -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}
<ComponentErrorState

View File

@ -92,8 +92,8 @@ export const gridLayout = (node, metadata) => {
}
// 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 = {