File tree 2 files changed +26
-28
lines changed
invokeai/frontend/web/src
app/store/middleware/listenerMiddleware/listeners
2 files changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { omit } from 'lodash-es';
11
11
import { boardsApi } from 'services/api/endpoints/boards' ;
12
12
import { imagesApi } from 'services/api/endpoints/images' ;
13
13
import type { ImageDTO } from 'services/api/types' ;
14
+ import { getCategories , getListImagesUrl } from 'services/api/util' ;
14
15
const log = logger ( 'gallery' ) ;
15
16
16
17
/**
@@ -59,6 +60,29 @@ export const addImageUploadedFulfilledListener = (startAppListening: AppStartLis
59
60
return ;
60
61
}
61
62
63
+ if ( imageUploadedClientSide . match ( action ) ) {
64
+ const categories = getCategories ( imageDTO ) ;
65
+ const boardId = imageDTO . board_id ?? 'none' ;
66
+ dispatch (
67
+ imagesApi . util . invalidateTags ( [
68
+ {
69
+ type : 'ImageList' ,
70
+ id : getListImagesUrl ( {
71
+ board_id : boardId ,
72
+ categories,
73
+ } ) ,
74
+ } ,
75
+ {
76
+ type : 'Board' ,
77
+ id : boardId ,
78
+ } ,
79
+ {
80
+ type : 'BoardImagesTotal' ,
81
+ id : boardId ,
82
+ } ,
83
+ ] )
84
+ ) ;
85
+ }
62
86
const state = getState ( ) ;
63
87
64
88
log . debug ( { imageDTO } , 'Image uploaded' ) ;
Original file line number Diff line number Diff line change @@ -318,37 +318,11 @@ export const imagesApi = api.injectEndpoints({
318
318
} ,
319
319
} ) ,
320
320
createImageUploadEntry : build . mutation < ImageUploadEntryResponse , ImageUploadEntryRequest > ( {
321
- query : ( { width, height } ) => ( {
321
+ query : ( { width, height, board_id } ) => ( {
322
322
url : buildImagesUrl ( ) ,
323
323
method : 'POST' ,
324
- body : { width, height } ,
324
+ body : { width, height, board_id } ,
325
325
} ) ,
326
- invalidatesTags : ( result ) => {
327
- if ( ! result ) {
328
- // Don't add it to anything
329
- return [ ] ;
330
- }
331
- const categories = getCategories ( result . image_dto ) ;
332
- const boardId = result . image_dto . board_id ?? 'none' ;
333
-
334
- return [
335
- {
336
- type : 'ImageList' ,
337
- id : getListImagesUrl ( {
338
- board_id : boardId ,
339
- categories,
340
- } ) ,
341
- } ,
342
- {
343
- type : 'Board' ,
344
- id : boardId ,
345
- } ,
346
- {
347
- type : 'BoardImagesTotal' ,
348
- id : boardId ,
349
- } ,
350
- ] ;
351
- } ,
352
326
} ) ,
353
327
deleteBoard : build . mutation < DeleteBoardResult , string > ( {
354
328
query : ( board_id ) => ( { url : buildBoardsUrl ( board_id ) , method : 'DELETE' } ) ,
You can’t perform that action at this time.
0 commit comments