11import { Box , Flex , forwardRef , Grid , GridItem , Skeleton , Spinner , Text } from '@invoke-ai/ui-library' ;
22import { createSelector } from '@reduxjs/toolkit' ;
33import { logger } from 'app/logging/logger' ;
4- import { EMPTY_ARRAY } from 'app/store/constants' ;
54import { useAppSelector , useAppStore } from 'app/store/storeHooks' ;
5+ import type { selectListImageNamesQueryArgs } from 'features/gallery/store/gallerySelectors' ;
66import {
77 LIMIT ,
88 selectGalleryImageMinimumWidth ,
99 selectImageToCompare ,
1010 selectLastSelectedImage ,
11- selectListImageNamesQueryArgs ,
1211} from 'features/gallery/store/gallerySelectors' ;
1312import { imageToCompareChanged , selectionChanged } from 'features/gallery/store/gallerySlice' ;
1413import { useRegisteredHotkeys } from 'features/system/components/HotkeysModal/useHotkeyData' ;
@@ -24,12 +23,13 @@ import type {
2423 VirtuosoGridHandle ,
2524} from 'react-virtuoso' ;
2625import { VirtuosoGrid } from 'react-virtuoso' ;
27- import { useGetImageNamesQuery , useListImagesQuery } from 'services/api/endpoints/images' ;
26+ import { useListImagesQuery } from 'services/api/endpoints/images' ;
2827import type { ImageDTO } from 'services/api/types' ;
2928import { useDebounce } from 'use-debounce' ;
3029
3130import { GalleryImage } from './ImageGrid/GalleryImage' ;
3231import { GallerySelectionCountTag } from './ImageGrid/GallerySelectionCountTag' ;
32+ import { useGalleryImageNames } from './use-gallery-image-names' ;
3333
3434const log = logger ( 'gallery' ) ;
3535
@@ -396,21 +396,6 @@ const useKeepSelectedImageInView = (
396396 } , [ imageName , imageNames , rangeRef , rootRef , virtuosoRef ] ) ;
397397} ;
398398
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-
414399const useScrollableGallery = ( rootRef : RefObject < HTMLDivElement > ) => {
415400 const [ scroller , scrollerRef ] = useState < HTMLElement | null > ( null ) ;
416401 const [ initialize , osInstance ] = useOverlayScrollbars ( {
0 commit comments