mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
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:
parent
3a9201bd31
commit
da5907613b
@ -11,12 +11,6 @@ import {
|
|||||||
import { useListImagesQuery } from 'services/api/endpoints/images';
|
import { useListImagesQuery } from 'services/api/endpoints/images';
|
||||||
import type { ListImagesArgs } from 'services/api/types';
|
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.
|
// 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
|
// 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
|
// 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.
|
* This hook is a singleton.
|
||||||
*/
|
*/
|
||||||
export const useGalleryImages = (): UseGalleryImagesReturn => {
|
export const useGalleryImages = () => {
|
||||||
const galleryView = useAppSelector((s) => s.gallery.galleryView);
|
const galleryView = useAppSelector((s) => s.gallery.galleryView);
|
||||||
const baseQueryArgs = useAppSelector(selectListImagesBaseQueryArgs);
|
const baseQueryArgs = useAppSelector(selectListImagesBaseQueryArgs);
|
||||||
const queryArgs = useStore($queryArgs);
|
const queryArgs = useStore($queryArgs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user