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

fix: localStorage availability check update #588

Merged

Conversation

iuriizaporozhets
Copy link
Contributor

@iuriizaporozhets iuriizaporozhets commented Jul 25, 2024

When in Safari set Block All cookies then local storage also will not work. But window.localStorage object itself will be available and when we will try set or get something from local storage we will get SecurityError: The operation is insecure. error and it is crashing the application for users with disabled cookies and local storage.

Copy link

vercel bot commented Jul 25, 2024

@iuriizaporozhets is attempting to deploy a commit to the 47ng Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@franky47 franky47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

I see an issue with the current way it's implemented: if a client has a localStorage value under the test key, it would get cleared by what should otherwise be an idempotent function.

One alternative would be to read the value before attempting a write, and restore it at the end, or use a more specifically-named key, which won't cause collisions.

fix: formatting and naming fixes
Copy link
Member

@franky47 franky47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@franky47 franky47 merged commit b128078 into 47ng:next Jul 25, 2024
1 check failed
@franky47 franky47 mentioned this pull request Jul 25, 2024
Copy link

🎉 This PR is included in version 1.17.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants