@daveyplate/supabase-swr-entities
Version:
An entity management library for Supabase and SWR
41 lines (40 loc) • 2.44 kB
TypeScript
import { SWRConfiguration } from "swr";
/**
* Wraps useSWR with custom fetcher and getKey
*/
export declare function useInfiniteCache(url: string | null, config?: SWRConfiguration | null): import("swr/infinite").SWRInfiniteResponse<any, any>;
export declare function useCache(url: string | null, config?: SWRConfiguration | null): import("swr").SWRResponse<any, any, {
errorRetryInterval?: number | undefined;
errorRetryCount?: number;
loadingTimeout?: number | undefined;
focusThrottleInterval?: number | undefined;
dedupingInterval?: number | undefined;
refreshInterval?: number | ((latestData: any) => number) | undefined;
refreshWhenHidden?: boolean;
refreshWhenOffline?: boolean;
revalidateOnFocus?: boolean | undefined;
revalidateOnReconnect?: boolean | undefined;
revalidateOnMount?: boolean;
revalidateIfStale?: boolean | undefined;
shouldRetryOnError?: boolean | ((err: any) => boolean) | undefined;
keepPreviousData?: boolean;
suspense?: boolean;
fallbackData?: any;
fetcher: import("swr").BareFetcher<any>;
use?: import("swr").Middleware[];
fallback?: {
[key: string]: any;
} | undefined;
isPaused?: (() => boolean) | undefined;
onLoadingSlow?: ((key: string, config: Readonly<import("swr/_internal").PublicConfiguration<any, any, import("swr").BareFetcher<any>>>) => void) | undefined;
onSuccess?: ((data: any, key: string, config: Readonly<import("swr/_internal").PublicConfiguration<any, any, import("swr").BareFetcher<any>>>) => void) | undefined;
onError?: ((err: any, key: string, config: Readonly<import("swr/_internal").PublicConfiguration<any, any, import("swr").BareFetcher<any>>>) => void) | undefined;
onErrorRetry?: ((err: any, key: string, config: Readonly<import("swr/_internal").PublicConfiguration<any, any, import("swr").BareFetcher<any>>>, revalidate: import("swr").Revalidator, revalidateOpts: Required<import("swr").RevalidatorOptions>) => void) | undefined;
onDiscarded?: ((key: string) => void) | undefined;
compare?: ((a: any, b: any) => boolean) | undefined;
isOnline?: (() => boolean) | undefined;
isVisible?: (() => boolean) | undefined;
initFocus?: ((callback: () => void) => (() => void) | void) | undefined;
initReconnect?: ((callback: () => void) => (() => void) | void) | undefined;
provider?: (cache: Readonly<import("swr").Cache>) => import("swr").Cache;
}>;