ngrx / store-devtools

Developer Tools for @ngrx/store
MIT License
325 stars 38 forks source link

Universal apps can't render with devtools #22

Closed dballance closed 8 years ago

dballance commented 8 years ago

Filed an issue for tracking even though we discussed in gitter.

Currently the below section prevents universal rendering of the application due to the call to window.

const REDUX_DEVTOOLS_EXTENSION_PROVIDER = {
  provide: REDUX_DEVTOOLS_EXTENSION,
  useFactory() {
    if (window && (window as any).devToolsExtension) {
      return (window as any).devToolsExtension;
    }
    return null;
  }
};

Can be rectified by modifying the check for the window object.

const REDUX_DEVTOOLS_EXTENSION_PROVIDER = {
  provide: REDUX_DEVTOOLS_EXTENSION,
  useFactory() {
    if (typeof window !== 'undefined' && (window as any).devToolsExtension) {
      return (window as any).devToolsExtension;
    }
    return null;
  }
};

Will try to send a PR tonight.

dballance commented 8 years ago

23 should rectify, but still have questions about how this will interact with HMR / server state hydration.

MikeRyanDev commented 8 years ago

Merged