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

Doesn't seem to work on refresh #18

Closed
amritk opened this issue Aug 19, 2021 · 3 comments · May be fixed by #29 or #32
Closed

Doesn't seem to work on refresh #18

amritk opened this issue Aug 19, 2021 · 3 comments · May be fixed by #29 or #32

Comments

@amritk
Copy link
Contributor

amritk commented Aug 19, 2021

I see the data in localStorage, however when I hit refresh, the data is there then it gets cleared before it can get loaded into the form.

useFormPersist(
    'form',
    { watch, setValue },
    {
      storage: window.localStorage,
    }
  )

SessionStorage works but can't figure out whats wrong with localStorage.

@amritk
Copy link
Contributor Author

amritk commented Aug 19, 2021

Looks like it is setting an empty object in the bottom useEffect after setting value with restoredData

tiaanduplessis added a commit that referenced this issue May 15, 2022
@tiaanduplessis
Copy link
Owner

Should be resolved with v3.0.0

@mkhennoussi
Copy link

Hi everyone,

The issue is still there for me. I am using Next.js with :

    "react-hook-form": "^7.36.1",
    "react-hook-form-persist": "^3.0.0"

The data is visible in the local Storage but it gets cleared before it can get loaded into the form.

Any ideas ? Thanks !

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