-
Notifications
You must be signed in to change notification settings - Fork 24
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
Using localStorage to keep registry state when page reloaded #21
Comments
@mrzacarias This would break our "isomorphic" goal, in that it would not be applicable in Node.js or another JavaScript environment. Of course we could probably check the environment and only write if in browser. Saving state by default would not always be a desirable behavior. In our original use case, we wanted to track page load times, so resetting all of the metrics between refreshes was okay. One way to generalize this would be to add the ability to de-serialize metrics from a string. That would keep things environment-agnostic. |
Hi there,
Not a critical issue, but something that will be nice to have. Right now, whenever the user refresh the page, the registry state is lost forever. The way I'm doing now to solve this problem is quite brittle.
I store the JSON stringfied registry in the localStorage:
And then, whenever the registry is created, I check localStorage to see if there's any saved state there, loading it if so:
Yep, it's an edge case and losing some metrics on refreshes is not the end of the world, but would be nice to have support from the lib for keeping the state if needed. 👍
The text was updated successfully, but these errors were encountered: