-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
chore: upgrade to zod v4 #4039
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
Open
carderne
wants to merge
7
commits into
main
Choose a base branch
from
chore/zod-4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
chore: upgrade to zod v4 #4039
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2761a35
chore(webapp): upgrade @conform-to to v1
carderne 971ffea
fix(webapp): conform v1 form fixes from review
carderne e5d7cff
fix(webapp): show conform v1 server errors in purchase modals
carderne df95d9b
chore: upgrade to zod v4
carderne 2b0f9e9
fix test failures
carderne 4a249c1
fix: address coderabbit feedback on zod v4 migration
carderne 822ea2f
fix(webapp): use @conform-to/zod/v4 subpath for zod 4 compatibility
carderne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "@trigger.dev/core": patch | ||
| "@trigger.dev/sdk": patch | ||
| "trigger.dev": patch | ||
| "@trigger.dev/redis-worker": patch | ||
| "@trigger.dev/schema-to-json": patch | ||
| --- | ||
|
|
||
| Add zod v4 compatibility. The `zod` peer dependency is widened to `^3.25.0 || ^4.0.0`, so projects can use zod 3.25+ or zod 4. Internal code was updated for zod v4 API changes (`ZodError.errors` → `.issues`, single-arg `z.record` → keyed, unified `error` option, `z.ZodSchema`/`z.AnyZodObject` → `z.ZodType`/`z.ZodObject`, `z.any()` object fields made `.optional()` to preserve v3 inference). No runtime behavior change for existing zod 3 users. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: improvement | ||
| --- | ||
|
|
||
| Upgrade the dashboard form layer from `@conform-to` 0.9 to 1.x. conform 1.x supports both zod 3 and zod 4, which unblocks the upcoming zod 4 upgrade. |
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Hidden form fields lose their explicit values, causing feedback submissions to redirect to an empty path
The page path for the feedback form is placed before the spread of auto-generated props (
getInputProps(fields.path, { type: "hidden" })atapps/webapp/app/components/Feedback.tsx:95), so the library's own value silently overrides it.Impact: Feedback submissions will send an empty or stale path field instead of the current page URL, breaking the post-submit redirect.
Conform v1 getInputProps returns a value prop for hidden inputs that overrides the explicit one
In conform v0.9,
conform.input(field, { type: "hidden" })returneddefaultValue, which doesn't conflict with an explicitvalueprop. In conform v1,getInputProps(field, { type: "hidden" })returns avalueprop (the field's current form-state value).When the JSX is
<input value={location.pathname} {...getInputProps(fields.path, { type: "hidden" })} />, the spread comes second and itsvalueoverwrites the explicitvalue={location.pathname}. Since nodefaultValueis set inuseFormfor thepathfield, the form submitspath=""instead ofpath="/current/page".The correct pattern in conform v1 is shown in
apps/webapp/app/routes/confirm-basic-details.tsx:315:— either pass
{ value: false }to disable auto-value, or put the explicitvalueafter the spread.Was this helpful? React with 👍 or 👎 to provide feedback.