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

fix: add window check before addEventListener #388

Merged
merged 2 commits into from
Oct 23, 2019

Conversation

datagutt
Copy link
Contributor

In scrollbar-width.js, the code was doing window.addEventListener even when window was undefined.
This broke simplebar in SSR environments.
This commits adds a check before trying to add the resize event.

In scrollbar-width, the code was doing window.addEventListener even when window was undefined.
This broke simplebar in SSR environments.
@datagutt
Copy link
Contributor Author

Looking at the codebase i believe this might not be the only issue in SSR environments.
It used to work fine in older versions though.

@NechiK NechiK mentioned this pull request Oct 21, 2019
@Grsmto
Copy link
Owner

Grsmto commented Oct 21, 2019

Amazing, thank you for your contribution!

Looking at the codebase i believe this might not be the only issue in SSR environments.

I'm not sure what you are refering to but the lib is supporting SSR, this specific case is a regression due to a change in a recent PR. So this fix only should be fine I think.

@datagutt datagutt requested a review from Grsmto October 22, 2019 09:39
@Grsmto
Copy link
Owner

Grsmto commented Oct 23, 2019

👏

@Grsmto Grsmto merged commit 8b166d3 into Grsmto:master Oct 23, 2019
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.

None yet

2 participants