File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed
invokeai/frontend/web/src
features/gallery/components/ImageViewer Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ export const ImageViewerContextProvider = memo((props: PropsWithChildren) => {
2929 const $progressEvent = useState ( ( ) => atom < S [ 'InvocationProgressEvent' ] | null > ( null ) ) [ 0 ] ;
3030 const $progressImage = useState ( ( ) => atom < ProgressImageType | null > ( null ) ) [ 0 ] ;
3131 const $hasProgressImage = useState ( ( ) => computed ( $progressImage , ( progressImage ) => progressImage !== null ) ) [ 0 ] ;
32+ // We can have race conditions where we receive a progress event for a queue item that has already finished. Easiest
33+ // way to handle this is to keep track of finished queue items in a cache and ignore progress events for those.
3234 const [ finishedQueueItemIds ] = useState ( ( ) => new LRUCache < number , boolean > ( { max : 200 } ) ) ;
3335
3436 useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ const selectModelInstalls = modelsApi.endpoints.listModelInstalls.select();
4646export const setEventListeners = ( { socket, store, setIsConnected } : SetEventListenersArg ) => {
4747 const { dispatch, getState } = store ;
4848
49+ // We can have race conditions where we receive a progress event for a queue item that has already finished. Easiest
50+ // way to handle this is to keep track of finished queue items in a cache and ignore progress events for those.
4951 const finishedQueueItemIds = new LRUCache < number , boolean > ( { max : 100 } ) ;
5052
5153 socket . on ( 'connect' , ( ) => {
You can’t perform that action at this time.
0 commit comments