From 471a5838a340f927bad256946f5340ca88be233b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 31 Aug 2023 08:50:06 +0100 Subject: [PATCH] Ensure null IDs are pruned from draggable list to avoid crashing --- .../settings/controls/DraggableList.svelte | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/DraggableList.svelte b/packages/builder/src/components/design/settings/controls/DraggableList.svelte index b1f0e83654..c8395b2a1f 100644 --- a/packages/builder/src/components/design/settings/controls/DraggableList.svelte +++ b/packages/builder/src/components/design/settings/controls/DraggableList.svelte @@ -33,17 +33,19 @@ let anchors = {} let draggableItems = [] - const buildDragable = items => { - return items.map(item => { - return { - id: listItemKey ? item[listItemKey] : generate(), - item, - } - }) + const buildDraggable = items => { + return items + .map(item => { + return { + id: listItemKey ? item[listItemKey] : generate(), + item, + } + }) + .filter(item => item.id) } $: if (items) { - draggableItems = buildDragable(items) + draggableItems = buildDraggable(items) } const updateRowOrder = e => {