-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TypeScript): support binding with optional fields
BREAKING CHANGE: TypeScript the `value` property of `BinderNode` now has optionally `undefined` type for non-initialised optional fields. In terms of forms, an object field could be used in both ways: as an individual field or a grouping for the object’s nested fields. Previously, the optional fields in empty form value objects were initialised by the client-side binder with a generated value when `BinderNode` or form binding is created for such fields. Such a behavior works well with grouping object fields, but makes it problematic to bind an individual optional field of object type by making empty value already defined. With this change, the client-side form binder skips initialising optional fields, keeping their values `undefined`, unless there is a binding for a nested field inside an optional parent object. For example: with a binding for `model.optionalObject` will have a corresponding empty form value of `{"optionalObject": undefined}`, however, with a binding of `model.optionalObject.nestedString`, the empty form value will contain a generated object: `{"optioanlObject": {"nestedString": ""}}`.
- Loading branch information
Showing
5 changed files
with
84 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters