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 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 => {