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 SSR onDestroy - ensure document before calling removeEventListener #37

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

oscarhermoso
Copy link
Contributor

Closes #36

src/index.svelte Outdated
document.removeEventListener('mouseup', onDragStopped)
document.removeEventListener('touchmove', onTouchMove)
document.removeEventListener('touchend', onDragStopped)
if (document) {
Copy link
Owner

Choose a reason for hiding this comment

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

You might want to even do typeof document !== 'undefined' actually because accessing the variable could even fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cheers, amended the commit

@ValentinH ValentinH merged commit 8523ac8 into ValentinH:master Oct 31, 2022
@ValentinH
Copy link
Owner

Thanks for the fix!

This was released as https://github.com/ValentinH/svelte-easy-crop/releases/tag/v1.0.8

sanozie pushed a commit to sanozie/svelte-easy-crop that referenced this pull request Oct 10, 2023
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.

Error during SSR due to onDestroy / cleanEvents being called
2 participants