From 1f7a3d5a2f731995ebdc50edb610f4b5aef59152 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Thu, 15 Aug 2024 14:52:59 +0100 Subject: [PATCH] fix: null check cards on layout init Signed-off-by: Pedro Lamas --- src/store/layout/mutations.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/store/layout/mutations.ts b/src/store/layout/mutations.ts index a81fb4553f..98b63eea1d 100644 --- a/src/store/layout/mutations.ts +++ b/src/store/layout/mutations.ts @@ -39,7 +39,10 @@ export const mutations: MutationTree = { const defaultLayout = defaultState.layouts[migratableLayoutKey] const defaultComponentIds = Object.values(defaultLayout).flat().map(card => card.id) const currentLayout = payload.layouts[layoutKey] - const currentComponentIds = Object.values(currentLayout).flat().map(card => card.id) + const currentComponentIds = Object.values(currentLayout) + .flat() + .filter(card => card != null) // required as we have seen null cards in the database + .map(card => card.id) for (const [containerKey, defaultContainerComponents] of Object.entries(defaultLayout)) { const currentContainerComponents = currentLayout[containerKey] || []