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

[material-ui][SwipeableDrawer] Safe access of ref value in SwipeableDrawer #45411

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shapeinabox
Copy link

In the company I work for we're using MUI as the base for the designs system, and we started receiving a Sentry issue affecting a non-trivial amount of users. Mostly happening on our capacitor app on iOS devices.

image image

After some investigation, it seems clear the error is surfacing from the mui code. Here's a screenshot of the minified code from the capacitor bundled file that Sentry mentioned.

image

Looking in the material-ui codebase for a similar line of code that could cause the issue, I stumbled upon the SwipeableDrawer, where I found a condition that looks really similar to the minified code that's throwing the error. Indeed, it looks like the ref is not accessed safely in the if condition.

This simple fix I'm submitting here should solve the issue.

@shapeinabox shapeinabox changed the title [fix][material-ui] Safe access of ref value in SwipeableDrawer [material-ui][SwipeableDrawer] Safe access of ref value in SwipeableDrawer Feb 25, 2025
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Can you please create a reproduction. I can't think of scenarios where these refs won't be already defined. Have you investigated what may be causing this?

@zannager zannager added the component: SwipeableDrawer The React component. label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: SwipeableDrawer The React component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants