File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
invokeai/frontend/web/src/features/gallery/components Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { navigationApi } from 'features/ui/layouts/navigation-api';
6
6
import { useGalleryPanel } from 'features/ui/layouts/use-gallery-panel' ;
7
7
import { selectActiveTab } from 'features/ui/store/uiSelectors' ;
8
8
import { memo , useCallback , useMemo } from 'react' ;
9
+ import { flushSync } from 'react-dom' ;
9
10
import { useTranslation } from 'react-i18next' ;
10
11
import { PiCrosshairBold } from 'react-icons/pi' ;
11
12
@@ -23,7 +24,9 @@ export const ImageMenuItemLocateInGalery = memo(() => {
23
24
const onClick = useCallback ( ( ) => {
24
25
navigationApi . expandRightPanel ( ) ;
25
26
galleryPanel . expand ( ) ;
26
- dispatch ( boardIdSelected ( { boardId : imageDTO . board_id ?? 'none' , selectedImageName : imageDTO . image_name } ) ) ;
27
+ flushSync ( ( ) => {
28
+ dispatch ( boardIdSelected ( { boardId : imageDTO . board_id ?? 'none' , selectedImageName : imageDTO . image_name } ) ) ;
29
+ } ) ;
27
30
} , [ dispatch , galleryPanel , imageDTO ] ) ;
28
31
29
32
return (
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { navigationApi } from 'features/ui/layouts/navigation-api';
17
17
import { useGalleryPanel } from 'features/ui/layouts/use-gallery-panel' ;
18
18
import { selectActiveTab } from 'features/ui/store/uiSelectors' ;
19
19
import { memo , useCallback , useMemo } from 'react' ;
20
+ import { flushSync } from 'react-dom' ;
20
21
import { useTranslation } from 'react-i18next' ;
21
22
import {
22
23
PiArrowsCounterClockwiseBold ,
@@ -45,7 +46,9 @@ export const CurrentImageButtons = memo(({ imageDTO }: { imageDTO: ImageDTO }) =
45
46
const locateInGallery = useCallback ( ( ) => {
46
47
navigationApi . expandRightPanel ( ) ;
47
48
galleryPanel . expand ( ) ;
48
- dispatch ( boardIdSelected ( { boardId : imageDTO . board_id ?? 'none' , selectedImageName : imageDTO . image_name } ) ) ;
49
+ flushSync ( ( ) => {
50
+ dispatch ( boardIdSelected ( { boardId : imageDTO . board_id ?? 'none' , selectedImageName : imageDTO . image_name } ) ) ;
51
+ } ) ;
49
52
} , [ dispatch , galleryPanel , imageDTO ] ) ;
50
53
51
54
const isCanvasOrGenerateTab = tab === 'canvas' || tab === 'generate' ;
You can’t perform that action at this time.
0 commit comments