mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.79k stars 1.9k forks source link

Wrap resetDirty in a useCallback #7029

Closed anthony-dandrea closed 1 week ago

anthony-dandrea commented 3 weeks ago

I am using useForm and had the result in a dependency array. I noticed that it caused needless executions. I ended up destructuring the result of useForm and adding those items to the dependency array. I noticed it worked except for resetDirty. It appears it's the only action not wrapped in a useCallback. I don't see any reason why it couldn't be so I cut a quick PR.

Semi-related issue: https://github.com/mantinedev/mantine/issues/5338

mr-pinzhang commented 2 weeks ago

ping @rtivital, that'd be great if Mantine Team could take a look at this issue.

rtivital commented 1 week ago

Thanks!