fix(ui): race condition queue status

Sequence of events causing the race condition:
- Enqueue batch
- Invalidate `SessionQueueStatus` tag
- Request updated queue status via HTTP - batch still processing at this point
- Batch completes
- Event emitted saying so
- Optimistically update the queue status cache, it is correct
- HTTP request makes it back and overwrites the optimistic update, indicating the batch is still in progress

FIxed by not invalidating the cache.
This commit is contained in:
psychedelicious 2024-08-20 21:00:26 +10:00
parent 19434e73b4
commit d3cdcef36b

View File

@ -70,7 +70,7 @@ export const queueApi = api.injectEndpoints({
body: arg,
method: 'POST',
}),
invalidatesTags: ['SessionQueueStatus', 'CurrentSessionQueueItem', 'NextSessionQueueItem'],
invalidatesTags: ['CurrentSessionQueueItem', 'NextSessionQueueItem'],
onQueryStarted: async (arg, api) => {
const { dispatch, queryFulfilled } = api;
try {