frontend-pattern
frontend-pattern copied to clipboard
chore(deps): bump @reduxjs/toolkit from 2.3.0 to 2.6.0
Bumps @reduxjs/toolkit from 2.3.0 to 2.6.0.
Release notes
Sourced from @reduxjs/toolkit's releases.
v2.6.0
This feature release adds infinite query support to RTK Query.
Changelog
RTK Query Infinite Query support
Since we first released RTK Query in 2021, we've had users asking us to add support for "infinite queries" - the ability to keep fetching additional pages of data for a given endpoint. It's been by far our most requested feature. Until recently, our answer was that we felt there were too many use cases to support with a single API design approach.
Last year, we revisited this concept and concluded that the best approach was to mimic the flexible infinite query API design from React Query. We had additional discussions with
@tkdodo, who described the rationale and implementation approach and encouraged us to use their API design, and@riqtsprovided an initial implementation on top of RTKQ's existing internals.We're excited to announce that this release officially adds full infinite query endpoint support to RTK Query!
Using Infinite Queries
As with React Query, the API design is based around "page param" values that act as the query arguments for fetching a specific page for the given cache entry.
Infinite queries are defined with a new
build.infiniteQuery()endpoint type. It accepts all of the same options as normal query endpoints, but also needs an additionalinfiniteQueryOptionsfield that specifies the infinite query behaviors. With TypeScript, you must supply 3 generic arguments:build.infiniteQuery<ResultType, QueryArg, PageParam>, whereResultTypeis the contents of a single page,QueryArgis the type passed in as the cache key, andPageParamis the value used to request a specific page.The endpoint must define an
initialPageParamvalue that will be used as the default (and can be overridden if desired). It also needs agetNextPageParamcallback that will calculate the params for each page based on the existing values, and optionally agetPreviousPageParamcallback if reverse fetching is needed. Finally, amaxPagesoption can be provided to limit the entry cache size.The
queryandqueryFnmethods now receive a{queryArg, pageParam}object, instead of just thequeryArg.For the cache entries and hooks, the
datafield is now an object like{pages: ResultType[], pageParams: PageParam[]>. This gives you flexibility in how you use the data for rendering.const pokemonApi = createApi({ baseQuery: fetchBaseQuery({ baseUrl: 'https://example.com/pokemon' }), endpoints: (build) => ({ // 3 TS generics: page contents, query arg, page param getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({ infiniteQueryOptions: { // Must provide a default initial page param value initialPageParam: 1, // Optionally limit the number of cached pages maxPages: 3, // Must provide a `getNextPageParam` function getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) => lastPageParam + 1, // Optionally provide a `getPreviousPageParam` function getPreviousPageParam: ( firstPage, allPages, firstPageParam, allPageParams, ) => { return firstPageParam > 0 ? firstPageParam - 1 : undefined }, }, // The `query` function receives `{queryArg, pageParam}` as its argument </tr></table>
... (truncated)
Commits
18ddd7eRelease 2.6.009e1466RTKQ Infinite Query integration (#4738)7897c4cMerge pull request #4847 from Tasin5541/doc-lazy-query-resetcdb264fdoc: update type definitions for lazy query hooks to include reset method801d7eaRelease 2.5.1aaeda15Removeconsole-testing-library(#4603)fa97936Update Docusaurus to v3 (#4774)4f3bc9fEnsure upserted cache entries always get written (#4768)6590cecRelease 2.5.02047f54Handle additionalserializeQueryArgs+skipTokencase (#4762)- Additional commits viewable in compare view
You can trigger a rebase of this PR by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| frontend-pattern | ❌ Failed (Inspect) | Mar 1, 2025 9:00am |
Superseded by #74.