fix(webui): resolve upload card freeze for unsupported files (#284)

This commit is contained in:
Yiling-J
2026-08-09 15:16:41 +08:00
committed by GitHub
parent d15fc5c6be
commit 442568de00
4 changed files with 55 additions and 3 deletions
@@ -116,7 +116,15 @@ export function FileCard({
},
})
const displayItem = polledItem || item
const displayItem = useMemo(() => {
if (item.status === 'processed' || item.status === 'error') {
return item
}
if (polledItem?.status === 'processed' || polledItem?.status === 'error') {
return polledItem
}
return polledItem || item
}, [item, polledItem])
// dnd-kit hooks
const { ref: setDraggableRef, isDragging: isDraggableDragging } = useDraggable({
@@ -91,7 +91,15 @@ export function FileListItem({
},
})
const displayItem = polledItem || item
const displayItem = useMemo(() => {
if (item.status === 'processed' || item.status === 'error') {
return item
}
if (polledItem?.status === 'processed' || polledItem?.status === 'error') {
return polledItem
}
return polledItem || item
}, [item, polledItem])
// dnd-kit hooks
const { ref: setDraggableRef, isDragging: isDraggableDragging } = useDraggable({