RTK Query infinite query docs expose `isFetchNextPageError`, but React hook does not
Description
The RTK Query infinite query documentation lists isFetchNextPageError and isFetchPreviousPageError as return values of the generated React infinite query hook.
However, the actual useInfiniteQuery React hook implementation/types do not expose these properties.
Documentation
The official documentation lists:
isFetchingNextPage: boolean
isFetchingPreviousPage: boolean
isFetchNextPageError: boolean
isFetchPreviousPageError: booleanSee:
https://redux-toolkit.js.org/rtk-query/api/created-api/hooks
Reproduction
Using @reduxjs/[email protected]:
const {
isFetchingNextPage,
isFetchNextPageError,
} = api.useGetSomethingInfiniteQuery(arg);TypeScript reports:
Property 'isFetchNextPageError' does not exist on type
'UseInfiniteQueryStateDefaultResult<...>'.Source
UseInfiniteQueryStateBaseResult currently exposes:
hasNextPage: boolean;
hasPreviousPage: boolean;
isFetchingNextPage: boolean;
isFetchingPreviousPage: boolean;but does not expose:
isFetchNextPageError: boolean;
isFetchPreviousPageError: boolean;The generated React hook returns queryStateResults together with fetchNextPage, fetchPreviousPage, and refetch, but does not add these error flags separately.
Expected behavior
Either:
isFetchNextPageError/isFetchPreviousPageErrorshould be exposed by the React infinite-query hook as documented, or- The API documentation should be corrected if these flags are not intended to be part of the public hook result.
Environment
@reduxjs/toolkit: 2.12.0- RTK Query
- React generated infinite query hooks
- TypeScript
This is particularly useful for infinite-scroll UIs where an error loading the next page needs to be distinguished from an error loading the initial page.
Source: reduxjs/redux-toolkit