1
1
import { Box , Flex , forwardRef , Grid , GridItem , Skeleton , Spinner , Text } from '@invoke-ai/ui-library' ;
2
2
import { createSelector } from '@reduxjs/toolkit' ;
3
3
import { logger } from 'app/logging/logger' ;
4
- import { EMPTY_ARRAY } from 'app/store/constants' ;
5
4
import { useAppSelector , useAppStore } from 'app/store/storeHooks' ;
5
+ import type { selectListImageNamesQueryArgs } from 'features/gallery/store/gallerySelectors' ;
6
6
import {
7
7
LIMIT ,
8
8
selectGalleryImageMinimumWidth ,
9
9
selectImageToCompare ,
10
10
selectLastSelectedImage ,
11
- selectListImageNamesQueryArgs ,
12
11
} from 'features/gallery/store/gallerySelectors' ;
13
12
import { imageToCompareChanged , selectionChanged } from 'features/gallery/store/gallerySlice' ;
14
13
import { useRegisteredHotkeys } from 'features/system/components/HotkeysModal/useHotkeyData' ;
@@ -24,12 +23,13 @@ import type {
24
23
VirtuosoGridHandle ,
25
24
} from 'react-virtuoso' ;
26
25
import { VirtuosoGrid } from 'react-virtuoso' ;
27
- import { useGetImageNamesQuery , useListImagesQuery } from 'services/api/endpoints/images' ;
26
+ import { useListImagesQuery } from 'services/api/endpoints/images' ;
28
27
import type { ImageDTO } from 'services/api/types' ;
29
28
import { useDebounce } from 'use-debounce' ;
30
29
31
30
import { GalleryImage } from './ImageGrid/GalleryImage' ;
32
31
import { GallerySelectionCountTag } from './ImageGrid/GallerySelectionCountTag' ;
32
+ import { useGalleryImageNames } from './use-gallery-image-names' ;
33
33
34
34
const log = logger ( 'gallery' ) ;
35
35
@@ -396,21 +396,6 @@ const useKeepSelectedImageInView = (
396
396
} , [ imageName , imageNames , rangeRef , rootRef , virtuosoRef ] ) ;
397
397
} ;
398
398
399
- const getImageNamesQueryOptions = {
400
- selectFromResult : ( { data, isLoading, isFetching } ) => ( {
401
- imageNames : data ?? EMPTY_ARRAY ,
402
- isLoading,
403
- isFetching,
404
- } ) ,
405
- } satisfies Parameters < typeof useGetImageNamesQuery > [ 1 ] ;
406
-
407
- export const useGalleryImageNames = ( ) => {
408
- const _queryArgs = useAppSelector ( selectListImageNamesQueryArgs ) ;
409
- const [ queryArgs ] = useDebounce ( _queryArgs , DEBOUNCE_DELAY ) ;
410
- const { imageNames, isLoading, isFetching } = useGetImageNamesQuery ( queryArgs , getImageNamesQueryOptions ) ;
411
- return { imageNames, isLoading, isFetching, queryArgs } ;
412
- } ;
413
-
414
399
const useScrollableGallery = ( rootRef : RefObject < HTMLDivElement > ) => {
415
400
const [ scroller , scrollerRef ] = useState < HTMLElement | null > ( null ) ;
416
401
const [ initialize , osInstance ] = useOverlayScrollbars ( {
0 commit comments