Add an option to reset/replace all fields in group in withFieldGroup
#1684
Unanswered
TheMightyDev
asked this question in
Ideas
Replies: 0 comments
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.
-
withFieldGroup
is 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
group
property obtained in therender
property ofwithFieldGroup
:group.resetAllFields
which will reset all fields to their default values. Alternatively, if no argument is passed togroup.resetField
it'd reset all fields.group.replaceAllFields
which 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.deleteAllFields
could also be an API or if no argument is passed togroup.deleteField
it'd delete all fieldsBeta Was this translation helpful? Give feedback.
All reactions