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

Missing props.onReset dependency in useCallback of resetForm function. #3861

Closed
rajpatelbot opened this issue Aug 9, 2023 · 1 comment · Fixed by #3872
Closed

Missing props.onReset dependency in useCallback of resetForm function. #3861

rajpatelbot opened this issue Aug 9, 2023 · 1 comment · Fixed by #3872

Comments

@rajpatelbot
Copy link
Contributor

Bug report

Current Behavior

If we have alternative thing to reset like search and filter, so suppose i have a object which have search and filter key and at first the i searched something and then i do filter and now after filter i reset the search value and then i reset the filter then the automatically the previous searched value comes in search and again i have to press on reset search button to clear it.

Expected behavior

I am expecting that after clicking the resetFilter button the search should not take the previously searched value.

Suggested solution(s)

In the resetForm function the useCallback should have dependency props.onReset.

Additional context

Reference line: https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Formik.tsx#L420

Your environment

Software Version(s)
Formik 2.4.2
React 18.2.0
TypeScript 5.0.2
Browser Chrome
npm/Yarn npm
Operating System Windows 10
@kodiakhq kodiakhq bot closed this as completed in #3872 Aug 31, 2023
kodiakhq bot pushed a commit that referenced this issue Aug 31, 2023
Closes: #3861

As i mentioned in the issue section that the unexpected behaviour is comming while using resetForm function due to missing dependency. Here is the fix.
@rajpatelbot
Copy link
Contributor Author

rajpatelbot commented Oct 6, 2023

After fixing the dependency issue, still same behaviour happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant