Skip to content

fix(nodes): reset edit form with initial values on open#53

Open
web-ppanel wants to merge 2 commits into
mainfrom
fix/node-edit-form-reset-with-initial-values
Open

fix(nodes): reset edit form with initial values on open#53
web-ppanel wants to merge 2 commits into
mainfrom
fix/node-edit-form-reset-with-initial-values

Conversation

@web-ppanel
Copy link
Copy Markdown
Contributor

Problem

When clicking the Edit button on a node, form.reset() was called with no arguments, clearing all fields to their default values (empty strings, port: 0, etc.). Since initialValues (the row reference) did not change, the useEffect that repopulates the form from initialValues never re-fired — so the edit sheet opened with a blank form.

Submitting the blank form triggered Zod validation errors, shown as "Invalid input" toasts.

Fix

Pass the normalized initialValues into form.reset() on trigger click, so the edit sheet always opens pre-filled with the current node data.

Closes #51

Rafa-Ross and others added 2 commits May 12, 2026 05:48
… 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
When the Edit button is clicked, form.reset() was called with no
arguments, clearing all fields to default values. Because initialValues
(the row object) didn't change, the useEffect that repopulates the form
never re-fired, leaving the form blank. Saving then triggered Zod
validation errors ('Invalid input') since required fields were empty.

Fix: pass the normalized initialValues into form.reset() on the trigger
onClick, so the edit sheet always opens pre-filled with the current
node's data.

Closes #51
@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for ppane-docs ready!

Name Link
🔨 Latest commit b8e19b5
🔍 Latest deploy log https://app.netlify.com/projects/ppane-docs/deploys/6a02c180b1a1160008045313
😎 Deploy Preview https://deploy-preview-53--ppane-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants