[material-ui][SwipeableDrawer] Safe access of ref value in SwipeableDrawer #45411
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
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.