-
Notifications
You must be signed in to change notification settings - Fork 5
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
Make useStorage hooks more reliable (probably) #55
Conversation
Also don't fall back to plain global state for session storage when session storage is not available. The caller may rightly assume that session state persists across page reloads, which plain global state does not.
Great! Look like it's working, we are testing it a bit more and we will merge it. |
I've been digging more into the issue of hanging on the spinner, and it seems I can still reproduce it fairly reliably by
This still results in hanging on the spinner fairly often. But I think this might have to do with other state management throughout the app. 🙂 I've noticed that |
I believe the spinner issue might be resolved with this commit: gunet@ffd6535 |
Cool! |
…rontend into reliable-storage
We've seen problems with the login procedure sometimes failing to set
privateData
in local storage. This seems to be because the internaluseState
hook sometimes fails to updatecurrentValue
even thoughsetValue()
was called. This made the internaluseEffect
hook fail to write the new value into local storage, and also made the new state fail to propagate to other instances of theuseStorage
hook.I don't know why this happens, but these changes refactor the data flow such that the public setter function always writes to local (or session) storage and then notifies other
useStorage
instances with the same name. This seems to make the login procedure reliably setprivateData
successfully.I have seen some issues with this too, namely that the login procedure would hang on the eDiplomas spinner and not move on to the logged-in view. However, this only happened when I had some
console.log
statememts throughout the hooks for debugging. I have not seen the issue without theseconsole.log
statements, so I hope this is fine? Anyway, just so you know in case that issue returns.