fix(nodes): normalize null tags to [] in node-form to prevent Invalid input error#52
Open
web-ppanel wants to merge 1 commit into
Open
fix(nodes): normalize null tags to [] in node-form to prevent Invalid input error#52web-ppanel wants to merge 1 commit into
web-ppanel wants to merge 1 commit into
Conversation
… input error When a node was created without tags (tags is null from API), editing it caused an 'Invalid input' validation error because null failed z.array(z.string()) validation. - Use z.preprocess to coerce null/undefined to [] in zod schema - Add normalizeValues() helper to ensure tags is always [] before spreading initialValues into form defaultValues and reset() Closes #51
✅ Deploy Preview for ppane-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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
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.
Fixes #51
When a node was created without tags, the API returns
tags: null. Editing such a node caused an "Invalid input" error becausenullfailedz.array(z.string())validation, blocking saves.Fix:
z.preprocessto coerce null/undefined to[]in the zod schemanormalizeValues()helper to sanitizeinitialValuesbefore form default/reset