fix(ui): fix typing of usGalleryImages

For some reason `ReturnType<typeof useListImagesQuery>` isn't working correctly, and destructuring `queryResult` it results in `any`, when the hook is used.

I've removed the explicit return typing so that consumers of the hook get correct types.
This commit is contained in:
psychedelicious 2024-01-09 13:03:33 +11:00 committed by Kent Keirsey
parent 3a9201bd31
commit da5907613b

View File

@ -11,12 +11,6 @@ import {
import { useListImagesQuery } from 'services/api/endpoints/images';
import type { ListImagesArgs } from 'services/api/types';
export type UseGalleryImagesReturn = {
handleLoadMoreImages: () => void;
areMoreImagesAvailable: boolean;
queryResult: ReturnType<typeof useListImagesQuery>;
};
// The gallery is a singleton but multiple components need access to its query data.
// If we don't define the query args outside of the hook, then each component will
// have its own query args and trigger multiple requests. We use an atom to store
@ -28,7 +22,7 @@ const $queryArgs = atom<ListImagesArgs | null>(null);
*
* This hook is a singleton.
*/
export const useGalleryImages = (): UseGalleryImagesReturn => {
export const useGalleryImages = () => {
const galleryView = useAppSelector((s) => s.gallery.galleryView);
const baseQueryArgs = useAppSelector(selectListImagesBaseQueryArgs);
const queryArgs = useStore($queryArgs);