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

[docs] Fix crash access to localStorage in Firefox #37518

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

brijeshb42
Copy link
Contributor

This avoids the page crashing when accessed in Firefox with cookies disabled

Fixes #37514

This avoids the page crashing when accessed in Firefox with cookies disabled
@brijeshb42 brijeshb42 added docs Improvements or additions to the documentation website Pages that are not documentation-related, marketing-focused. labels Jun 6, 2023
@mui-bot
Copy link

mui-bot commented Jun 6, 2023

Netlify deploy preview

https://deploy-preview-37518--material-ui.netlify.app/

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against dbd235c

@brijeshb42 brijeshb42 marked this pull request as ready for review June 6, 2023 10:50
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

This makes sense, it's definitely not the first time I see this one https://github.com/mui/material-ui/pulls?q=is%3Apr+localStorage+is%3Aclosed. In MUI X, we even have an helper to detect when it's available https://github.com/mui/mui-x/blob/6be8bcbac5c6df70bf476005383df8731135f573/packages/grid/x-data-grid/src/utils/utils.ts#L13.

I find it concerning that Firefox doesn't allow people to persist the localStorage when cookies are disabled. There is no memory of what the previous session's settings were 🙃. But anyway, it's a tradeoff users are taking by disabling first-party cookies, so I think we are good.

@oliviertassinari oliviertassinari changed the title [docs] wrap calls to localStorage in try/catch [docs] Fix crash access to localStorage in Firefox Jun 6, 2023
@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Jun 6, 2023
@brijeshb42
Copy link
Contributor Author

@oliviertassinari Can you approve it?

@brijeshb42 brijeshb42 merged commit 0d3aba1 into mui:master Jun 8, 2023
17 of 19 checks passed
@brijeshb42 brijeshb42 deleted the docs-fix-disabled-cookies branch June 8, 2023 15:02
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 8, 2023

I try not to approve changes, so we don't depend on me 😁, it looks simple enough to be merged with little supervision 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work docs Improvements or additions to the documentation website Pages that are not documentation-related, marketing-focused.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs] mui.com crashes with cookies disabled and JS enabled
3 participants