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

Reset a part of the form #137

Open
logaretm opened this issue Feb 22, 2025 · 0 comments
Open

Reset a part of the form #137

logaretm opened this issue Feb 22, 2025 · 0 comments
Labels
✨ enhancement New feature or request 🗂️ form-management Issues related to managing form groups, repeaters, and overall state handling 🛠️ p2-medium Issues that should be addressed but are less urgent
Milestone

Comments

@logaretm
Copy link
Member

logaretm commented Feb 22, 2025

What

Similar to our query methods like isValid and isDirty accepting a path to return the partial respective state for that path, we would like to do the same for reset.

Typing wise, we can use function overloading here. the form.reset could accept a string path for the path to reset, this will come in handy later with the devtools resetting fields and paths.

const { reset } = useForm();

// Reset the entire form
reset();
// Reset the entire form to a specific state
reset({ value: { field: 'abc' } });

// Reset a part of the form
reset('some.path');
// Reset a part of the form to a specific state
reset('some.path', { value: 'newValue' });
@logaretm logaretm added ✨ enhancement New feature or request 🗂️ form-management Issues related to managing form groups, repeaters, and overall state handling 🛠️ p2-medium Issues that should be addressed but are less urgent labels Feb 22, 2025
@logaretm logaretm added this to the v1.0 milestone Feb 22, 2025
@logaretm logaretm added this to Roadmap Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request 🗂️ form-management Issues related to managing form groups, repeaters, and overall state handling 🛠️ p2-medium Issues that should be addressed but are less urgent
Projects
Status: No status
Development

No branches or pull requests

1 participant