Skip to content

Fix unreliable window and document detection #246

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

Merged
merged 3 commits into from
Sep 23, 2016
Merged

Fix unreliable window and document detection #246

merged 3 commits into from
Sep 23, 2016

Conversation

viktorbezdek
Copy link
Contributor

The method used for detecting DOM availability was sloppy and breaks server side rendering in some cases. This new approach fix cases when global variable window is defined in NodeJS by checking presence of window.document and window.document.createElement which are used in element resize detection.

Signed-off-by: Viktor Bezděk <viktor.bezdek@siteone.cz>
…ts published to fix ssr issues

Signed-off-by: Viktor Bezděk <viktor.bezdek@siteone.cz>
@istarkov
Copy link
Collaborator

istarkov commented Sep 22, 2016

Thank you!

  1. Please remove all .gitignore files, https://github.com/istarkov/google-map-react/blob/master/.gitignore does your git tool not support that?
  2. was sloppy and breaks server side rendering in some cases - please provide that cases and why just typeof window is not enough.

@viktorbezdek
Copy link
Contributor Author

  1. Dammit, I committed compiled files to my fork just to be able to use my fork as a dependency temporarily before you publish the patch. Should have make topic branch for the pull request.
  2. One of the cases is quite simple - my application have to use private module that I have no control of. This module requires global variable window with some unrelated data, so typeof window !== 'undefined' become truthy and SSR breaks. New solution only makes deeper more robust checking. There is another, more tricky, case but I have to debug my app I bit more to make sure it's not issue on my side.

I'll fix files in the repo in sec. Will let you know.

…246 gets published to fix ssr issues"

This reverts commit 7e19a86.
@viktorbezdek
Copy link
Contributor Author

The last commit is reverted. If you accept the pull request, please publish the patch asap.

@istarkov istarkov merged commit 94eac51 into google-map-react:master Sep 23, 2016
@istarkov
Copy link
Collaborator

Thank you!!! Will publish today.

@lock
Copy link

lock bot commented Dec 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants