Change the way getInitialValue
works with undefined
s
#1171
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
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 useundefined
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 ofundefined
s. Similarly, objects should not have anyundefined
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.
The text was updated successfully, but these errors were encountered: