Re-enable the processing items checks

This commit is contained in:
Jackson Harper
2024-08-20 13:19:29 +08:00
parent a871049000
commit 51f9fb0c2d
2 changed files with 23 additions and 9 deletions

View File

@ -188,16 +188,16 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
.map((li) => li.node.id)
}, [libraryItems])
// const refreshProcessingItems = useRefreshProcessingItems()
const refreshProcessingItems = useRefreshProcessingItems()
// useEffect(() => {
// if (processingItems.length) {
// refreshProcessingItems.mutateAsync({
// attempt: 0,
// itemIds: processingItems,
// })
// }
// }, [processingItems])
useEffect(() => {
if (processingItems.length) {
refreshProcessingItems.mutateAsync({
attempt: 0,
itemIds: processingItems,
})
}
}, [processingItems])
const focusFirstItem = useCallback(() => {
if (libraryItems.length < 1) {

View File

@ -676,6 +676,20 @@ export function useRefreshProcessingItems() {
.map((it) => it.node.id)
: variables.itemIds,
})
} else if (shouldRefetch) {
console.log('failed for edges: ', data?.edges)
// There are still processing items, but we've reached max attempts
// so we will mark them as failed.
for (const item of data?.edges ?? []) {
if (item.node.state == State.PROCESSING) {
updateItemStateInCache(
queryClient,
item.node.id,
item.node.slug,
State.FAILED
)
}
}
}
},
})