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

Add support for testValue definitions in nested props only #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zchsh
Copy link
Contributor

@zchsh zchsh commented Mar 6, 2021

This PR removes the need to defined an empty base testValue: {} for object properties. An effect of this change is that object properties will now return an empty object as their testValue, even if it is not defined.

We may or may not want to make this change, just suggesting it as defining an empty object as a testValue at multiple levels in hashicorp/react-components#154 felt odd.

The approach taken here is:

  • If testValue on an object prop is not explicitly set, then we'll default it to {}. This way, we don't have to explicitly set the base empty object testValue: {} at every level of a complex object prop.
  • The current behaviour is still possible - it can be opted into by explicitly setting testValue: undefined on the "object" prop. This only needs to be done once, at the "top level" of the tree.

@zchsh zchsh force-pushed the zs.tweak-object-props-test-value branch from 0ca792d to 4c41c38 Compare March 6, 2021 02:31
@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2022

CLA assistant check
All committers have signed the CLA.

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