Ensure null IDs are pruned from draggable list to avoid crashing

This commit is contained in:
Andrew Kingston 2023-08-31 08:50:06 +01:00
parent c1f344347d
commit 471a5838a3
1 changed files with 10 additions and 8 deletions

View File

@ -33,17 +33,19 @@
let anchors = {} let anchors = {}
let draggableItems = [] let draggableItems = []
const buildDragable = items => { const buildDraggable = items => {
return items.map(item => { return items
return { .map(item => {
id: listItemKey ? item[listItemKey] : generate(), return {
item, id: listItemKey ? item[listItemKey] : generate(),
} item,
}) }
})
.filter(item => item.id)
} }
$: if (items) { $: if (items) {
draggableItems = buildDragable(items) draggableItems = buildDraggable(items)
} }
const updateRowOrder = e => { const updateRowOrder = e => {