Skip to content

Commit

Permalink
fix: null check cards on layout init
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed Aug 15, 2024
1 parent e3ed531 commit 1f7a3d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/store/layout/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export const mutations: MutationTree<LayoutState> = {
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] || []
Expand Down

0 comments on commit 1f7a3d5

Please sign in to comment.