From 533a597a0b08c7460c9aff8e244590d416d67362 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sat, 10 Aug 2024 18:52:24 +0100 Subject: [PATCH] Performance improvements --- .../client/src/components/Component.svelte | 10 ++-- .../app/container/GridContainer.svelte | 30 +++++----- .../components/preview/GridDNDHandler.svelte | 11 +--- .../preview/GridStylesButton.svelte | 4 +- .../src/components/preview/SettingsBar.svelte | 59 ++++++++++--------- packages/client/src/utils/grid.js | 4 +- 6 files changed, 59 insertions(+), 59 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 8083678482..b9ff2ed1d8 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -40,6 +40,7 @@ getActionDependentContextKeys, } from "../utils/buttonActions.js" import { gridLayout } from "utils/grid.js" + import { memo } from "@budibase/frontend-core" export let instance = {} export let parent = null @@ -53,7 +54,7 @@ const component = getContext("component") // Create component context - const store = writable({}) + const store = memo({}) setContext("component", store) // Ref to the svelte component @@ -206,7 +207,8 @@ } // Metadata to pass into grid action to apply CSS - $: gridMetadata = { + let gridMetadata = memo() + $: gridMetadata.set({ active: parent?._component.endsWith("/container") && parent?.layout === "grid", id, @@ -215,7 +217,7 @@ draggable, definition, errored: errorState, - } + }) // Update component context $: store.set({ @@ -668,7 +670,7 @@ data-name={name} data-icon={icon} data-parent={$component.id} - use:gridLayout={gridMetadata} + use:gridLayout={$gridMetadata} > {#if errorState} @@ -134,9 +137,6 @@