From ff499d14616c29351d94764dfeb16fff115b760c Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 5 Feb 2024 11:29:39 +0000 Subject: [PATCH] Move selected layout out of layout store --- packages/builder/src/stores/builder/layouts.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/stores/builder/layouts.js b/packages/builder/src/stores/builder/layouts.js index dc57798c48..e9a84a1d4a 100644 --- a/packages/builder/src/stores/builder/layouts.js +++ b/packages/builder/src/stores/builder/layouts.js @@ -16,12 +16,6 @@ export class LayoutStore extends BudiStore { this.syncAppLayouts = this.syncAppLayouts.bind(this) this.select = this.select.bind(this) this.deleteLayout = this.deleteLayout.bind(this) - - this.selectedLayout = derived(this.store, $store => { - return $store.layouts?.find( - layout => layout._id === $store.selectedLayoutId - ) - }) } reset() { @@ -78,4 +72,6 @@ export class LayoutStore extends BudiStore { export const layoutStore = new LayoutStore() -export const selectedLayout = layoutStore.selectedLayout +export const selectedLayout = derived(layoutStore, $store => { + return $store.layouts?.find(layout => layout._id === $store.selectedLayoutId) +})