react-hook-form-persist icon indicating copy to clipboard operation
react-hook-form-persist copied to clipboard

Fix/fix development error with react strict mode

Open BorjaRafolsMartinez opened this issue 2 years ago • 4 comments

Hello.

This fixes a bug that happens when using react-hook-form with defaultValues option.

https://beta.reactjs.org/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development

It basically makes sure it only runs once using the good old _mounted ref.

Should fix: https://github.com/tiaanduplessis/react-hook-form-persist/issues/18

I also added a test.

BorjaRafolsMartinez avatar Jan 09 '23 13:01 BorjaRafolsMartinez

@tiaanduplessis

BorjaRafolsMartinez avatar Jan 09 '23 14:01 BorjaRafolsMartinez

this works for me, thank you, I believe it should be merged

pedro757 avatar Jan 24 '24 18:01 pedro757

Can we merge this please? I would like to have this soon otherwise will have to patch it manually

JGJP avatar Feb 12 '24 09:02 JGJP

tbh I think this PR makes a bunch of changes that are unrelated to the original issue

JGJP avatar Feb 14 '24 07:02 JGJP