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
Checking that the window is defined before accessing it. #66
Conversation
Following the fix laid out here for universal apps.
|
Looking good. I'll have a quick scan through, but i do not think we are using any other browser globals on launch. |
src/state/create-store.js
Outdated
import { applyMiddleware, createStore, compose } from 'redux'; | ||
import thunk from 'redux-thunk'; | ||
import reducer from './reducer'; | ||
import hookMiddleware from './hook-middleware'; | ||
import type { Store, Hooks } from '../types'; | ||
|
||
// eslint-disable-next-line no-underscore-dangle | ||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | ||
const composeEnhancers = typeof window === 'object' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment above stating
- We are checking if window is available because it might not be when server side rendering
- That this came from https://github.com/zalmoxisus/redux-devtools-extension#12-advanced-store-setup
Thanks for looking into this @romellogood !!!! |
I have forked your example. I found it was not doing the correct SSR (it was returning |
Once you add the comments listed above we are good to go |
Made the changes you requested! |
🎉 I will try to do a release tomorrow afternoon which will contain this fix. Well done @romellogood ! |
Thanks :) |
Should take care of issue #65
Checking that the window is defined before accessing it so that the module doesn't break on the server.