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

feat(forms): allow null as initial value #2275

Merged
merged 17 commits into from
Oct 1, 2024

Conversation

Gerbuuun
Copy link
Contributor

@Gerbuuun Gerbuuun commented Sep 28, 2024

πŸ”— Linked issue

Resolves #1210

❓ 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

Added a model modifier to UInput and UTextarea to make the value return null if the field value is falsy (because initial values may not be a string?).
I'm not actually sure if the type change is allowed like this.
Does the native element support an initial value of null? I suppose it is similar to undefined...

πŸ“ Checklist

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

@benjamincanac benjamincanac changed the title feat: add nullable modifier to input and textarea feat(Input/Textarea): add nullable modifier Sep 30, 2024
@benjamincanac benjamincanac changed the title feat(Input/Textarea): add nullable modifier feat(Input/Textarea): add nullable modifier Sep 30, 2024
src/runtime/components/forms/Input.vue Outdated Show resolved Hide resolved
src/runtime/components/forms/Input.vue Outdated Show resolved Hide resolved
Gerbuuun and others added 2 commits September 30, 2024 13:52
@Gerbuuun
Copy link
Contributor Author

I've created a new feature request for the model modifier (#2281). I'll update this PR to only include the type changes. After that we can discuss the modifier.

@Gerbuuun Gerbuuun changed the title feat(Input/Textarea): add nullable modifier feat(Input/Textarea): allow null as initial value Sep 30, 2024
@Gerbuuun Gerbuuun changed the title feat(Input/Textarea): allow null as initial value feat: allow null as initial value Sep 30, 2024
Copy link
Collaborator

@romhml romhml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@benjamincanac benjamincanac changed the title feat: allow null as initial value feat(forms): allow null as initial value Oct 1, 2024
@benjamincanac benjamincanac merged commit 474accb into nuxt:dev Oct 1, 2024
2 checks passed
@benjamincanac
Copy link
Member

@romhml Do we need to do this on v3 as well?

@romhml
Copy link
Collaborator

romhml commented Oct 1, 2024

Yes, I'll take care of it.

patrick-hofmann pushed a commit to patrick-hofmann/nuxt-ui that referenced this pull request Oct 3, 2024
@Gerbuuun
Copy link
Contributor Author

Now actually trying this (@nuxt/[email protected]) it does not seem to work...
Is there a difference with component types between the playground and actual package?

Can someone confirm this works?

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.

Nullable inputs
3 participants