mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): invalidate cache for queue item on status change
This query is only subscribed-to in the `QueueItemDetail` component - when is rendered only when the user clicks on a queue item in the queue. Invalidating this tag instead of optimistically updating it won't cause any meaningful change to network traffic.
This commit is contained in:
parent
93e4c3dbc2
commit
f1bb7e86c0
@ -43,20 +43,15 @@ export const addSocketQueueItemStatusChangedEventListener = (startAppListening:
|
|||||||
queueApi.util.updateQueryData('getBatchStatus', { batch_id: batch_status.batch_id }, () => batch_status)
|
queueApi.util.updateQueryData('getBatchStatus', { batch_id: batch_status.batch_id }, () => batch_status)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update the queue item status (this is the full queue item, including the session)
|
|
||||||
dispatch(
|
|
||||||
queueApi.util.updateQueryData('getQueueItem', queue_item.item_id, (draft) => {
|
|
||||||
if (!draft) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Object.assign(draft, queue_item);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Invalidate caches for things we cannot update
|
// Invalidate caches for things we cannot update
|
||||||
// TODO: technically, we could possibly update the current session queue item, but feels safer to just request it again
|
// TODO: technically, we could possibly update the current session queue item, but feels safer to just request it again
|
||||||
dispatch(
|
dispatch(
|
||||||
queueApi.util.invalidateTags(['CurrentSessionQueueItem', 'NextSessionQueueItem', 'InvocationCacheStatus'])
|
queueApi.util.invalidateTags([
|
||||||
|
'CurrentSessionQueueItem',
|
||||||
|
'NextSessionQueueItem',
|
||||||
|
'InvocationCacheStatus',
|
||||||
|
{ type: 'SessionQueueItem', id: queue_item.item_id },
|
||||||
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (['in_progress'].includes(action.payload.data.queue_item.status)) {
|
if (['in_progress'].includes(action.payload.data.queue_item.status)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user