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

Portal - undefined document in SSR #400

Closed
kraus-milan opened this issue Oct 1, 2018 · 0 comments · Fixed by #422
Closed

Portal - undefined document in SSR #400

kraus-milan opened this issue Oct 1, 2018 · 0 comments · Fixed by #422
Assignees
Labels
Bug Something isn't working

Comments

@kraus-milan
Copy link

kraus-milan commented Oct 1, 2018

Portal doesn't work correctly in server side rendering.

Expected Behavior

Portal checks, whether document / window exists. If not, it doesn't render anything.

Current Behavior

Error is thrown in SSR because of missing document:

Render error ReferenceError: document is not defined
    at new Portal (/home/milan/Projects/kiwi/frontend/node_modules/@kiwicom/orbit-components/lib/Portal/index.js:41:190)

Possible Solution

if (typeof window === "undefined") do nothing

Steps to Reproduce

Use Portal in component, that renders on server.

Context (Environment)

server side rendering

@vepor vepor mentioned this issue Oct 2, 2018
@vepor vepor added the Bug Something isn't working label Oct 2, 2018
@vepor vepor mentioned this issue Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants