Skip to content
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

fix(Form)!: include nested state in submit data #3028

Draft
wants to merge 3 commits into
base: v3
Choose a base branch
from

Conversation

romhml
Copy link
Collaborator

@romhml romhml commented Jan 6, 2025

πŸ”— Linked issue

#2889

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Fixes an issue with nested form state not being included in the @submit event payload.
The proposed solution requires to apply schema transformation to the state (partially reverting #2701) to return the props.state object in the submit event data.

Another alternative would be to return a list of objects in the submit payload (with transformation applied) instead of the full object. We can't easily reconstruct the full object since we don't have the information of a nested form's state path within the parent form's state.

I added a new transform options in the form's validate function to control when transformations are applied. It's currently done on submit only.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@romhml romhml force-pushed the fix/nested-form-event-data branch from 5af9b23 to 07ac559 Compare January 6, 2025 12:57
@romhml romhml force-pushed the fix/nested-form-event-data branch from 07ac559 to 517acae Compare January 6, 2025 12:58
Copy link

cloudflare-workers-and-pages bot commented Jan 6, 2025

Deploying ui3 with Β Cloudflare Pages Β Cloudflare Pages

Latest commit: 34cdcd0
Status:Β βœ…Β  Deploy successful!
Preview URL: https://dca9eeaa.ui-6q2.pages.dev
Branch Preview URL: https://fix-nested-form-event-data.ui-6q2.pages.dev

View logs

Copy link

pkg-pr-new bot commented Jan 6, 2025

npm i https://pkg.pr.new/@nuxt/ui@3028

commit: 34cdcd0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants