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

Change the way getInitialValue works with undefineds #1171

Closed
radekmie opened this issue Oct 7, 2022 · 0 comments
Closed

Change the way getInitialValue works with undefineds #1171

radekmie opened this issue Oct 7, 2022 · 0 comments
Assignees
Labels
Area: Bridge Affects some of the bridge packages Bridge: GraphQL Affects the uniforms-bridge-graphql package Bridge: JSON Schema Affects the uniforms-bridge-json-schema package Bridge: SimpleSchema (v2) Affects the uniforms-bridge-simple-schema-2 package Bridge: SimpleSchema Affects the uniforms-bridge-simple-schema package Bridge: Zod Affects the uniforms-bridge-zod package Type: Feature New features and feature requests
Milestone

Comments

@radekmie
Copy link
Contributor

radekmie commented Oct 7, 2022

As I mentioned in #1164 (comment) and implemented already in #1169, I think we should slightly change the way getInitialValue works for arrays and objects. Right now, both will mostly use undefined as a valid nested value, producing rather unexpected models. Here's an example.

My proposal is to skip undefined values at all times, i.e., if we have an array with a minimum length, but the elements don't provide a default value, the array should be empty instead of consisted of undefineds. Similarly, objects should not have any undefined values.

One thing to consider is whether or not it should be the case for optional values or not. I think no, but let's see what you think.

@radekmie radekmie added Type: Feature New features and feature requests Area: Bridge Affects some of the bridge packages Bridge: GraphQL Affects the uniforms-bridge-graphql package Bridge: JSON Schema Affects the uniforms-bridge-json-schema package Bridge: SimpleSchema Affects the uniforms-bridge-simple-schema package Bridge: SimpleSchema (v2) Affects the uniforms-bridge-simple-schema-2 package labels Oct 7, 2022
@radekmie radekmie added this to the v4.0 milestone Oct 7, 2022
@radekmie radekmie self-assigned this Oct 7, 2022
@radekmie radekmie added this to Needs triage in Open Source (migrated) via automation Oct 7, 2022
@radekmie radekmie added the Bridge: Zod Affects the uniforms-bridge-zod package label Oct 9, 2022
@radekmie radekmie moved this from Needs triage to To do in Open Source (migrated) Oct 10, 2022
@radekmie radekmie moved this from To do to Review in Open Source (migrated) Oct 10, 2022
Open Source (migrated) automation moved this from Review to Closed Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Bridge Affects some of the bridge packages Bridge: GraphQL Affects the uniforms-bridge-graphql package Bridge: JSON Schema Affects the uniforms-bridge-json-schema package Bridge: SimpleSchema (v2) Affects the uniforms-bridge-simple-schema-2 package Bridge: SimpleSchema Affects the uniforms-bridge-simple-schema package Bridge: Zod Affects the uniforms-bridge-zod package Type: Feature New features and feature requests
Projects
Archived in project
Development

No branches or pull requests

1 participant