generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 183
feat: Add Standard Schema interface #965
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
ca05aac
to
748d789
Compare
2cad8bf
to
70f9ed7
Compare
70f9ed7
to
7162ec8
Compare
085449e
to
ada6de0
Compare
ada6de0
to
739faf1
Compare
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
739faf1
to
8381293
Compare
8381293
to
8c3efbe
Compare
This is an internal artifact of needing to resolve a type with or without a default value to make it non-nullable, and does not provide a strong key/value type-safety, for which loaders are the preferred way.
TanStack Router handles defaults a bit differently than nuqs, and would require a Partial output type for Links not to have to specify every single search param value for a given route. Moreover, the output of validateSearch is reflected in the URL a page load time, which contradicts the "clean URL first" approach taken by nuqs (it also reflects null values which is not desirable).
30f4397
to
7769705
Compare
🎉 This PR is included in version 2.5.0-beta.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new export,
createStandardSchemaV1
, which (as the name implies), creates a standard-schema compatible object that can be fed to tRPC's inputs, or TanStack Router for search params validation (see #953).Since nuqs parsers always assume they have to deal with deserialisation, and those validation libraries generally assume they work with data already of the right shape (kind of) and verify runtime constraints, we first run the input through the serializer to generate a URL, which we can then parse.
This also introduces a new option on the loaders & the cache: strict mode, which will throw errors rather than applying default values (or returning null) for invalid querystring values.
It also fixes a bug where the loader functions had a signature mismatching the runtime implementation: passing urlKeys is only supported when creating the loader function, which now can accept a different set of runtime options like strict mode. We're renaming the types to make this clearer.
It also deprecates
parseServerSide
for parsers, as it was an internal artefact of resolving a non-nullable type when specifying a default value. Loaders now have integrated parseServerSide's duties and do provide stronger key/value type-safety (while also supporting other things like strict mode and urlKeys).Tasks