react-query#UseInfiniteQueryOptions TypeScript Examples

The following examples show how to use react-query#UseInfiniteQueryOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: useApiInfinite.ts    From kinopub.webos with MIT License 6 votes vote down vote up
function useApiInfinite<T extends Method>(
  method: T,
  params: Parameters<ApiClient[T]> = [] as Parameters<ApiClient[T]>,
  options?: UseInfiniteQueryOptions<Methods[T]>,
) {
  const client = useMemo(() => new ApiClient(), []);
  const query = useInfiniteQuery<Methods[T], string, Methods[T]>(
    [method, ...params],
    ({ pageParam }) => {
      // @ts-expect-error
      return client[method](...params, pageParam) as Methods[T];
    },
    {
      // @ts-expect-error
      getNextPageParam: (lastPage: PaginationResponse) => {
        return lastPage?.pagination?.current + 1 || 1;
      },
      ...options,
    },
  );

  return query;
}
Example #2
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteDrugQuery = <
      TData = DrugQuery,
      TError = unknown
    >(
      variables?: DrugQueryVariables,
      options?: UseInfiniteQueryOptions<DrugQuery, TError, TData>
    ) =>{
    const query = useFetchData<DrugQuery, DrugQueryVariables>(DrugDocument)
    return useInfiniteQuery<DrugQuery, TError, TData>(
      variables === undefined ? ['Drug.infinite'] : ['Drug.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #3
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteDrugsQuery = <
      TData = DrugsQuery,
      TError = unknown
    >(
      variables?: DrugsQueryVariables,
      options?: UseInfiniteQueryOptions<DrugsQuery, TError, TData>
    ) =>{
    const query = useFetchData<DrugsQuery, DrugsQueryVariables>(DrugsDocument)
    return useInfiniteQuery<DrugsQuery, TError, TData>(
      variables === undefined ? ['Drugs.infinite'] : ['Drugs.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #4
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteAllHustlersQuery = <
      TData = AllHustlersQuery,
      TError = unknown
    >(
      variables?: AllHustlersQueryVariables,
      options?: UseInfiniteQueryOptions<AllHustlersQuery, TError, TData>
    ) =>{
    const query = useFetchData<AllHustlersQuery, AllHustlersQueryVariables>(AllHustlersDocument)
    return useInfiniteQuery<AllHustlersQuery, TError, TData>(
      variables === undefined ? ['AllHustlers.infinite'] : ['AllHustlers.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #5
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteAllItemsQuery = <
      TData = AllItemsQuery,
      TError = unknown
    >(
      variables?: AllItemsQueryVariables,
      options?: UseInfiniteQueryOptions<AllItemsQuery, TError, TData>
    ) =>{
    const query = useFetchData<AllItemsQuery, AllItemsQueryVariables>(AllItemsDocument)
    return useInfiniteQuery<AllItemsQuery, TError, TData>(
      variables === undefined ? ['AllItems.infinite'] : ['AllItems.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #6
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteDopeListingQuery = <
      TData = DopeListingQuery,
      TError = unknown
    >(
      variables?: DopeListingQueryVariables,
      options?: UseInfiniteQueryOptions<DopeListingQuery, TError, TData>
    ) =>{
    const query = useFetchData<DopeListingQuery, DopeListingQueryVariables>(DopeListingDocument)
    return useInfiniteQuery<DopeListingQuery, TError, TData>(
      variables === undefined ? ['DopeListing.infinite'] : ['DopeListing.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #7
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteDopesQuery = <
      TData = DopesQuery,
      TError = unknown
    >(
      variables?: DopesQueryVariables,
      options?: UseInfiniteQueryOptions<DopesQuery, TError, TData>
    ) =>{
    const query = useFetchData<DopesQuery, DopesQueryVariables>(DopesDocument)
    return useInfiniteQuery<DopesQuery, TError, TData>(
      variables === undefined ? ['Dopes.infinite'] : ['Dopes.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #8
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteHustlerQuery = <
      TData = HustlerQuery,
      TError = unknown
    >(
      variables?: HustlerQueryVariables,
      options?: UseInfiniteQueryOptions<HustlerQuery, TError, TData>
    ) =>{
    const query = useFetchData<HustlerQuery, HustlerQueryVariables>(HustlerDocument)
    return useInfiniteQuery<HustlerQuery, TError, TData>(
      variables === undefined ? ['Hustler.infinite'] : ['Hustler.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #9
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteHustlersWalletQuery = <
      TData = HustlersWalletQuery,
      TError = unknown
    >(
      variables?: HustlersWalletQueryVariables,
      options?: UseInfiniteQueryOptions<HustlersWalletQuery, TError, TData>
    ) =>{
    const query = useFetchData<HustlersWalletQuery, HustlersWalletQueryVariables>(HustlersWalletDocument)
    return useInfiniteQuery<HustlersWalletQuery, TError, TData>(
      variables === undefined ? ['HustlersWallet.infinite'] : ['HustlersWallet.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #10
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteItemQuery = <
      TData = ItemQuery,
      TError = unknown
    >(
      variables?: ItemQueryVariables,
      options?: UseInfiniteQueryOptions<ItemQuery, TError, TData>
    ) =>{
    const query = useFetchData<ItemQuery, ItemQueryVariables>(ItemDocument)
    return useInfiniteQuery<ItemQuery, TError, TData>(
      variables === undefined ? ['Item.infinite'] : ['Item.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #11
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteProfileDopesQuery = <
      TData = ProfileDopesQuery,
      TError = unknown
    >(
      variables?: ProfileDopesQueryVariables,
      options?: UseInfiniteQueryOptions<ProfileDopesQuery, TError, TData>
    ) =>{
    const query = useFetchData<ProfileDopesQuery, ProfileDopesQueryVariables>(ProfileDopesDocument)
    return useInfiniteQuery<ProfileDopesQuery, TError, TData>(
      variables === undefined ? ['ProfileDopes.infinite'] : ['ProfileDopes.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #12
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteProfileHustlersQuery = <
      TData = ProfileHustlersQuery,
      TError = unknown
    >(
      variables?: ProfileHustlersQueryVariables,
      options?: UseInfiniteQueryOptions<ProfileHustlersQuery, TError, TData>
    ) =>{
    const query = useFetchData<ProfileHustlersQuery, ProfileHustlersQueryVariables>(ProfileHustlersDocument)
    return useInfiniteQuery<ProfileHustlersQuery, TError, TData>(
      variables === undefined ? ['ProfileHustlers.infinite'] : ['ProfileHustlers.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #13
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteProfileGearQuery = <
      TData = ProfileGearQuery,
      TError = unknown
    >(
      variables?: ProfileGearQueryVariables,
      options?: UseInfiniteQueryOptions<ProfileGearQuery, TError, TData>
    ) =>{
    const query = useFetchData<ProfileGearQuery, ProfileGearQueryVariables>(ProfileGearDocument)
    return useInfiniteQuery<ProfileGearQuery, TError, TData>(
      variables === undefined ? ['ProfileGear.infinite'] : ['ProfileGear.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #14
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteRenderDopeQuery = <
      TData = RenderDopeQuery,
      TError = unknown
    >(
      variables?: RenderDopeQueryVariables,
      options?: UseInfiniteQueryOptions<RenderDopeQuery, TError, TData>
    ) =>{
    const query = useFetchData<RenderDopeQuery, RenderDopeQueryVariables>(RenderDopeDocument)
    return useInfiniteQuery<RenderDopeQuery, TError, TData>(
      variables === undefined ? ['RenderDope.infinite'] : ['RenderDope.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #15
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteSearchDopeQuery = <
      TData = SearchDopeQuery,
      TError = unknown
    >(
      variables: SearchDopeQueryVariables,
      options?: UseInfiniteQueryOptions<SearchDopeQuery, TError, TData>
    ) =>{
    const query = useFetchData<SearchDopeQuery, SearchDopeQueryVariables>(SearchDopeDocument)
    return useInfiniteQuery<SearchDopeQuery, TError, TData>(
      ['SearchDope.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}
Example #16
Source File: graphql.ts    From dope-monorepo with GNU General Public License v3.0 6 votes vote down vote up
useInfiniteWalletQuery = <
      TData = WalletQuery,
      TError = unknown
    >(
      variables?: WalletQueryVariables,
      options?: UseInfiniteQueryOptions<WalletQuery, TError, TData>
    ) =>{
    const query = useFetchData<WalletQuery, WalletQueryVariables>(WalletDocument)
    return useInfiniteQuery<WalletQuery, TError, TData>(
      variables === undefined ? ['Wallet.infinite'] : ['Wallet.infinite', variables],
      (metaData) => query({...variables, ...(metaData.pageParam ?? {})}),
      options
    )}