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

Native form reset isn't executed if first fieldReference isn't a HTMLElement #8678

Merged
merged 2 commits into from Jul 14, 2022

Conversation

alexviar
Copy link
Contributor

If the first field evaluated in isHTMLElement(fieldReference) returns false then loop is skipped and native reset is not executed.

…MLElement

If the first field evaluated in `isHTMLElement(fieldReference)` returns `false` then loop is skipped and native reset is not executed.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 14, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 99a1938:

Sandbox Source
React Hook Form V7 (JS) Template Configuration
React Hook Form V7 (TS) Template Configuration

@alexviar alexviar changed the title Native form reset isn't executed if first fieldReference is not an HTMLElement Native form reset isn't executed if first fieldReference isn't a HTMLElement Jul 14, 2022
@bluebill1049
Copy link
Member

thanks for the PR. however, this is expected behavior, if we detect there are nonnative input presented in the form, we will have to flush the state update instead of using the native reset API.

@alexviar
Copy link
Contributor Author

thanks for the PR. however, this is expected behavior, if we detect there are nonnative input presented in the form, we will have to flush the state update instead of using the native reset API.

I don't quite understand what you mean, the current code also doesn't seem to do what you say because if the first field that is evaluated is a native input, the native reset is executed and the loop breaks regardless of whether or not there are non-native inputs in the form

@bluebill1049 bluebill1049 merged commit 8028e4d into react-hook-form:master Jul 14, 2022
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.

None yet

2 participants