disable exhaustive-dep bc i dont want it to change when baord changes

This commit is contained in:
Mary Hipp 2023-07-14 13:45:53 -04:00
parent 067d5b22b2
commit 6be3da4e71

View File

@ -73,19 +73,13 @@ const GalleryImageGrid = () => {
setLimit(INITIAL_IMAGE_LIMIT);
}, [selectedBoardId]);
const BASE_QUERY = useMemo(() => {
return {
categories:
galleryView === 'images' ? IMAGE_CATEGORIES : ASSETS_CATEGORIES,
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 }),
};
}, [galleryView, selectedBoardId]);
const { data: imageListResponse, isLoading: isLoading } =
useListImagesQuery(BASE_QUERY);
});
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) {