From 6be3da4e7104dd475ca985422eb6d3b5ece551a9 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Fri, 14 Jul 2023 13:45:53 -0400 Subject: [PATCH] disable exhaustive-dep bc i dont want it to change when baord changes --- .../components/ImageGrid/GalleryImageGrid.tsx | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx index dc1ab22fc8..8032e16e3c 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/GalleryImageGrid.tsx @@ -73,19 +73,13 @@ const GalleryImageGrid = () => { setLimit(INITIAL_IMAGE_LIMIT); }, [selectedBoardId]); - const BASE_QUERY = useMemo(() => { - return { - categories: - galleryView === 'images' ? IMAGE_CATEGORIES : ASSETS_CATEGORIES, - is_intermediate: false, - offset: 0, - limit: INITIAL_IMAGE_LIMIT, - ...(selectedBoardId === 'all' ? {} : { board_id: selectedBoardId }), - }; - }, [galleryView, selectedBoardId]); - - const { data: imageListResponse, isLoading: isLoading } = - useListImagesQuery(BASE_QUERY); + const { data: imageListResponse, isLoading: isLoading } = useListImagesQuery({ + categories: galleryView === 'images' ? IMAGE_CATEGORIES : ASSETS_CATEGORIES, + is_intermediate: false, + offset: 0, + limit: INITIAL_IMAGE_LIMIT, + ...(selectedBoardId === 'all' ? {} : { board_id: selectedBoardId }), + }); const { data: paginatedData } = useListImagesQuery( { @@ -108,7 +102,14 @@ const GalleryImageGrid = () => { dispatch( imagesApi.util.updateQueryData( 'listImages', - BASE_QUERY, + { + categories: + galleryView === 'images' ? IMAGE_CATEGORIES : ASSETS_CATEGORIES, + is_intermediate: false, + offset: 0, + limit: INITIAL_IMAGE_LIMIT, + ...(selectedBoardId === 'all' ? {} : { board_id: selectedBoardId }), + }, (draftPosts) => { paginatedData.items.forEach((item) => { draftPosts.items.push(item); @@ -117,7 +118,8 @@ const GalleryImageGrid = () => { ) ); } - }, [paginatedData, dispatch, BASE_QUERY]); + //eslint-disable-next-line + }, [paginatedData, dispatch]); const areMoreAvailable = useMemo(() => { if (imageListResponse?.total) {