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

[SSR] Fix window undefined bug #79

Merged
merged 4 commits into from
Sep 20, 2019

Conversation

pr1ntr
Copy link
Contributor

@pr1ntr pr1ntr commented Sep 13, 2019

flickity will call window as soon as its imported. In order to use with SSR it must be required on componentDidMount

This fix is confirmed working in Gatsby.
This is a new PR in in lieu of #78

@yaodingyd
Copy link
Owner

Again, please only make changes to src/index.js. Definitely don't make change to version in package.json. The release of a new version should be handle by repo owner.

@pr1ntr
Copy link
Contributor Author

pr1ntr commented Sep 13, 2019

Crap sorry, I thought you meant not to mess with lib/* files . Don't you think having a develop command is helpful for development the module with npm link? I can revert if not.

revert version
@yaodingyd
Copy link
Owner

It can be helpful but let's split different concerns into their own PR.

remove develop
@yaodingyd
Copy link
Owner

I still stand by #71 (comment), but I think this solution is much cleaner.

@pr1ntr
Copy link
Contributor Author

pr1ntr commented Sep 15, 2019

While I don't disagree with #71, practically, I don't believe that metafizzy will change their position anytime soon. In terms of React, server side rendering solutions are becoming much more approachable and popular so why not accommodate react developer using isomorphic or static with literally one line of code? :)

@theolampert theolampert merged commit bcc83fa into yaodingyd:master Sep 20, 2019
@theolampert
Copy link
Collaborator

theolampert commented Sep 20, 2019

Thank you for your work @pr1ntr !

@frazerf
Copy link

frazerf commented Feb 28, 2020

Leaving a comment here incase anyone is using flickity-fade and wondering why they're still getting the window undefined error.

You have to use the same fix here - #4 (comment) - i.e

const fade =
  typeof window !== "undefined"
    ? require("flickity-fade")
    : () => null

...to fix the issue. Hope this saves someone a couple of hours of digging.

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.

4 participants