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

Use optional chaining instead of non-null assert #82

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

Conversation

johnsonsu
Copy link

Fix #81

Due to events like onScroll that this library listens to are not synchronous, they can be fired right after the component is already unmounted, causing ref.current to be null. This PR fixes the issue by using optional chaining instead of non-null assertion on ref.current usages.

@MaksimLavrenyuk
Copy link

@thmsgbrt Can you appreciate this branch? It's an important fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onSrolll: null is not an object (evaluating 'P.current.classList')
2 participants