Add an option to reset/replace all fields in group in withFieldGroup
#1684
Unanswered
TheMightyDev
asked this question in
Ideas
Replies: 2 comments 1 reply
-
|
Sounds like alright ideas and good use cases! Shouldn't be that hard to implement either. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
So:
But how |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
withFieldGroupis a very powerful API! It'd be nice to modify entire group of fields at once - eitherreplace all of them with another value or reset all fields at once.
Perhaps we can edit new methods on
groupproperty obtained in therenderproperty ofwithFieldGroup:group.resetAllFieldswhich will reset all fields to their default values. Alternatively, if no argument is passed togroup.resetFieldit'd reset all fields.group.replaceAllFieldswhich will accept a single argument to replace all available fields at one go!It'd be super helpful in case the groups are fuill.
In my specific use case, my team uses discriminated unions and it's a bit of an hassle to manually delete and add fields on each discriminator key change.
Another suggestion:
group.deleteAllFieldscould also be an API or if no argument is passed togroup.deleteFieldit'd delete all fieldsBeta Was this translation helpful? Give feedback.
All reactions