@openstack_dev/gatsby-theme-marketing-oif-core 1.0.35-beta.5 → 1.0.35-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -7,20 +7,22 @@ import { store, getPersistor } from "./store";
|
|
|
7
7
|
import createEmotionCache from "../utils/createEmotionCache";
|
|
8
8
|
import AuthBootstrap from "../components/AuthBootstrap";
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const isBrowser = typeof window !== "undefined";
|
|
11
11
|
|
|
12
12
|
export function ReduxWrapper({ element }) {
|
|
13
13
|
const [persistor, setPersistor] = React.useState(null);
|
|
14
|
+
const cacheRef = React.useRef(null);
|
|
15
|
+
if (!cacheRef.current) cacheRef.current = createEmotionCache();
|
|
14
16
|
|
|
15
17
|
React.useEffect(() => {
|
|
16
18
|
setPersistor(getPersistor());
|
|
17
19
|
}, []);
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
|
-
<CacheProvider value={
|
|
22
|
+
<CacheProvider value={cacheRef.current}>
|
|
21
23
|
<Provider store={store}>
|
|
22
|
-
{persistor ? (
|
|
23
|
-
<PersistGate persistor={persistor} loading={
|
|
24
|
+
{isBrowser && persistor ? (
|
|
25
|
+
<PersistGate persistor={persistor} loading={element}>
|
|
24
26
|
<>
|
|
25
27
|
<AuthBootstrap />
|
|
26
28
|
{element}
|