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

bug: prevent crashes on hydration #146

Merged
merged 1 commit into from
Jun 10, 2023

Conversation

Quicksaver
Copy link
Contributor

On certain cases with SSR'd pages (i.e. Next.js), if we have some hydration issues, the Flickity component may first (or intermediately) render null, while still calling componentDidMount and componentDidUpdate.

Without a valid node, the app crashes trying to instantiate Flickity on null:
Screenshot 2023-06-01 at 12 24 39

This patch fixes that, by ensuring that this.carousel exists before trying to instantiate Flickity with it, ensuring that this.flkty exists before trying to access it.

@yaodingyd yaodingyd merged commit 0d8da68 into yaodingyd:master Jun 10, 2023
1 check passed
@yaodingyd
Copy link
Owner

thanks!

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