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: add default initial value for form component state #396

Merged
merged 2 commits into from
Feb 10, 2022

Conversation

dpilch
Copy link
Member

@dpilch dpilch commented Feb 10, 2022

Description of changes:

Set default initial state value for form components.

List was determined by interacting with TwoWayBinding tests on integration app and adding default initial values for components that gave a warning.

Todo in another change:
If a defaultValue is set by the customer and the component becomes controlled the defaultValue needs to be removed because the form components cannot have both defaultValue and value.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dpilch dpilch requested a review from a team February 10, 2022 15:57
@dpilch dpilch force-pushed the default-initial-state branch from d56a28e to ecbd5b5 Compare February 10, 2022 16:02
Comment on lines 133 to 134
export const PrimitiveDefaultPropertyValue: Partial<
Record<Primitive, { [property: string]: FixedStudioComponentProperty }>
Copy link
Contributor

@alharris-at alharris-at Feb 10, 2022

Choose a reason for hiding this comment

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

Not sure if it's more succinct or readable, but I think this can be defined as a PrimitiveLevelPropConfig<FixedStudioComponentProperty>

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh nice! I didn't notice we had that.

@codecov-commenter
Copy link

Codecov Report

Merging #396 (c9e6cbc) into tagged-release/q1-release (c254c5a) will decrease coverage by 0.00%.
The diff coverage is 93.33%.

Impacted file tree graph

@@                      Coverage Diff                      @@
##           tagged-release/q1-release     #396      +/-   ##
=============================================================
- Coverage                      93.27%   93.27%   -0.01%     
=============================================================
  Files                             43       43              
  Lines                           1681     1695      +14     
  Branches                         370      375       +5     
=============================================================
+ Hits                            1568     1581      +13     
- Misses                           110      111       +1     
  Partials                           3        3              
Impacted Files Coverage Δ
packages/codegen-ui-react/lib/workflow/mutation.ts 98.21% <92.85%> (-0.78%) ⬇️
packages/codegen-ui-react/lib/primitive.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c254c5a...c9e6cbc. Read the comment docs.

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.

3 participants