Commit 04ce3e71 authored by Felix Mosheev's avatar Felix Mosheev Committed by Tim Neutkens

Use process.browser instead of env probing (#6286)

parent 9bb8fbf5
......@@ -21,7 +21,7 @@ class MyMobxApp extends App {
constructor(props) {
super(props)
const isServer = typeof window === 'undefined'
const isServer = !process.browser;
this.mobxStore = isServer
? props.initialMobxState
: initializeStore(props.initialMobxState)
......
import { action, observable } from 'mobx'
import { useStaticRendering } from 'mobx-react'
const isServer = typeof window === 'undefined'
const isServer = !process.browser
useStaticRendering(isServer)
class Store {
......@@ -25,7 +25,8 @@ class Store {
}
let store = null
export function initializeStore(initialData) {
export function initializeStore (initialData) {
// Always make a new store if server, otherwise state is shared between requests
if (isServer) {
return new Store(isServer, initialData)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment