jossmac / react-scrolllock

🔒 Prevent scroll on the <body />
https://jossmac.github.io/react-scrolllock
MIT License
451 stars 43 forks source link

Handle when elements they lose their ref inside TouchScrollable #96

Open Nedomas opened 3 years ago

Nedomas commented 3 years ago

Posting it here just to check if anybody else had a problem with disappearing refs inside TouchScrollable.

An error with undefined this.scrollableArea in this.scrollableArea.removeEventListener started happening when I've started using React Suspense with React Router DOM. In certain scenarios if you load a route with Suspense on it, TouchScrollable sometimes loses this.scrollableArea value.

Not sure if there's something esoteric happening inside Suspense or there's something else - could not figure out. Was wondering if anybody else had a similar problem?

The diff here is just something that fixed my issue, but might be introducing some other problems later down the road.

Anyways - thanks for an amazing package!

changeset-bot[bot] commented 3 years ago

⚠️ No Changeset found

Latest commit: fa2dbe198b7cc9344417276d8430238cbe8d90ae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR