Skip to content

Conversation

@jsakas
Copy link
Contributor

@jsakas jsakas commented Aug 21, 2022

I was trying to use Joy UI to build a Figma plugin, but localStorage is not available in this environment and so the library could not be used. This would also be the case for private mode as mentioned in #33853

This PR just wraps all of the calls in a try / catch, which was how one call was already handled.

Another solution might be to create our own class, similar to a polyfill, that wraps localStorage and proxies commands with a try catch, so the code calling localStorage becomes smaller and potentially more readable.

I didn't not want to make too many assumptions about how MUI team wants to resolve the bug so let me know what you think and I will update if needed.

closes #33853

@mui-bot
Copy link

mui-bot commented Aug 21, 2022

Details of bundle changes

Generated by 🚫 dangerJS against 652b326

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

@siriwatknp siriwatknp added type: bug It doesn't behave as expected. scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI and removed type: bug It doesn't behave as expected. labels Aug 22, 2022
@siriwatknp siriwatknp merged commit a8315e0 into mui:master Aug 22, 2022
@oliviertassinari oliviertassinari added type: bug It doesn't behave as expected. type: regression A bug, but worse, it used to behave as expected. labels Sep 23, 2022
@oliviertassinari oliviertassinari changed the title [system] catch localStorage errors [system] Catch localStorage unavailability Sep 23, 2022
@oliviertassinari oliviertassinari removed the type: regression A bug, but worse, it used to behave as expected. label Sep 23, 2022
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[system] CssVarsProvider should not crash the app if local storage is unavailable

4 participants