Skip to content

Bump @reduxjs/toolkit from 1.8.1 to 2.7.0 #2555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

dependabot[bot]
Copy link

@dependabot dependabot bot commented on behalf of github Apr 17, 2025

Bumps @reduxjs/toolkit from 1.8.1 to 2.7.0.

Release notes

Sourced from @​reduxjs/toolkit's releases.

v2.7.0

RTK has hit Stage 2.7! 🤣 This feature release adds support for Standard Schema validation in RTK Query endpoints, fixes several issues with infinite queries, improves perf when infinite queries provide tags, adds a dev-mode check for duplicate middleware, and improves reference stability in slice selectors and infinite query hooks.

Changelog

Standard Schema Validation for RTK Query

Apps often need to validate responses from the server, both to ensure the data is correct, and to help enforce that the data matches the expected TS types. This is typically done with schema libraries such as Zod, Valibot, and Arktype. Because of the similarities in usage APIs, those libraries and others now support a common API definition called Standard Schema, allowing you to plug your chosen validation library in anywhere Standard Schema is supported.

RTK Query now supports using Standard Schema to validate query args, responses, and errors. If schemas are provided, the validations will be run and errors thrown if the data is invalid. Additionally, providing a schema allows TS inference for that type as well, allowing you to omit generic types from the endpoint.

Schema usage is per-endpoint, and can look like this:

import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
import * as v from 'valibot'
const postSchema = v.object({
id: v.number(),
name: v.string(),
})
type Post = v.InferOutput<typeof postSchema>
const api = createApi({
baseQuery: fetchBaseQuery({ baseUrl: '/' }),
endpoints: (build) => ({
getPost: build.query({
// infer arg from here
query: ({ id }: { id: number }) => /post/${id},
// infer result from here
responseSchema: postSchema,
}),
getTransformedPost: build.query({
// infer arg from here
query: ({ id }: { id: number }) => /post/${id},
// infer untransformed result from here
rawResponseSchema: postSchema,
// infer transformed result from here
transformResponse: (response) => ({
...response,
published_at: new Date(response.published_at),
}),
}),
}),
})

If desired, you can also configure schema error handling with the catchSchemaFailure option. You can also disable actual runtime validation with skipSchemaValidation (primarily useful for cases when payloads may be large and expensive to validate, but you still want to benefit from the TS type inference).

See the "Schema Validation" docs section in the createApi reference and the usage guide sections on queries, infinite queries, and mutations, for more details.

... (truncated)

Commits
  • 3592b08 Release 2.7.0
  • 9a8d429 Add catchSchemaFailure, and docs for RTKQ schema features (#4934)
  • ad4696c improve stability of useInfiniteQuerySubscription's return value (#4937)
  • ad2b288 Add meta handling for infinite queries (#4939)
  • 78833cb Improve duplicate middleware error and save build output (#4928)
  • e730507 Add duplicate middleware dev check to configureStore (#4927)
  • 9881b1a Drop TS 5.0 from compat matrix (#4925)
  • c89fce3 fix(rtk-query): useQuery hook does not refetch after resetApiState (#4758)
  • 45a95cb Allow standard schemas to validate endpoint values (#4864)
  • 9eb51e9 Rewrite providedTags handling for better perf (#4910)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will 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 version will 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 dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Apr 17, 2025
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/reduxjs/toolkit-2.7.0 branch 10 times, most recently from 643620c to 5c47087 Compare April 24, 2025 16:05
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/reduxjs/toolkit-2.7.0 branch 5 times, most recently from 94cb126 to 61cb820 Compare April 29, 2025 21:24
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/reduxjs/toolkit-2.7.0 branch 4 times, most recently from 3c4df45 to bb600c6 Compare May 6, 2025 19:51
Bumps [@reduxjs/toolkit](https://github.com/reduxjs/redux-toolkit) from 1.8.1 to 2.7.0.
- [Release notes](https://github.com/reduxjs/redux-toolkit/releases)
- [Commits](reduxjs/redux-toolkit@1.8.1...v2.7.0)

---
updated-dependencies:
- dependency-name: "@reduxjs/toolkit"
  dependency-version: 2.7.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/reduxjs/toolkit-2.7.0 branch from bb600c6 to 8a51c82 Compare May 8, 2025 15:32
Copy link
Author

dependabot bot commented on behalf of github May 9, 2025

Superseded by #2725.

@dependabot dependabot bot closed this May 9, 2025
@dependabot dependabot bot deleted the dependabot/npm_and_yarn/reduxjs/toolkit-2.7.0 branch May 9, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants