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

unregister(...) optional shouldDirty configuration parameter #3045

Closed
Frantss opened this issue Sep 30, 2020 · 1 comment · Fixed by #3741
Closed

unregister(...) optional shouldDirty configuration parameter #3045

Frantss opened this issue Sep 30, 2020 · 1 comment · Fixed by #3741

Comments

@Frantss
Copy link

Frantss commented Sep 30, 2020

Is your feature request related to a problem? Please describe.
I'm trying to unregister inputs and have them not affect the isDirty and dirtyFields properties.
Currently, after an input is unregistered, it sets isDirty to true.

Describe the solution you'd like
unregisters takes a second argument of type { shouldDirty: boolean }.
This will be a non-braking change, and also provide future proof if more configs need to be added.

Describe alternatives you've considered
Having a removeInput function that removes all references to the input from the state.

@bluebill1049 bluebill1049 added feature request request a feature to be added waiting-up-vote Waiting for votes from the community. labels Sep 30, 2020
@bluebill1049 bluebill1049 added this to Pending Feature Requests in React Hook Form Sep 30, 2020
@bluebill1049 bluebill1049 moved this from Pending Feature Requests to In progress in React Hook Form Jan 10, 2021
@bluebill1049 bluebill1049 moved this from In progress to API proposal / RFC in React Hook Form Jan 10, 2021
@bluebill1049 bluebill1049 moved this from API proposal / RFC to Pending Feature Requests in React Hook Form Jan 10, 2021
@bluebill1049 bluebill1049 removed feature request request a feature to be added waiting-up-vote Waiting for votes from the community. labels Jan 20, 2021
@bluebill1049 bluebill1049 moved this from Pending Feature Requests to API proposal / RFC in React Hook Form Jan 20, 2021
@bluebill1049
Copy link
Member

bluebill1049 commented Jan 20, 2021

proposal:

unregister: (
    name: FieldPath<TFieldValues> | FieldPath<TFieldValues>[],
    options?: Pick<
      KeepStateOptions,
      'keepErrors' | 'keepTouched' | 'keepDirty'
    >,
  ) => void;

@bluebill1049 bluebill1049 moved this from API proposal / RFC to In progress in React Hook Form Jan 22, 2021
@bluebill1049 bluebill1049 moved this from In progress to Done in React Hook Form Mar 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants