added fallback

This commit is contained in:
nklhrstv 2022-07-07 18:42:21 +03:00
parent 5889b422c3
commit 94c0016cad

View file

@ -36,7 +36,7 @@ function wrapPromise(promise) {
};
}
const withGetInitState = (Component) => {
const withGetInitState = (Component, Fallback = () => { }) => {
return function WithGetInitState(props) {
const { core } = useServices();
const initStateRef = React.useRef({});
@ -48,7 +48,7 @@ const withGetInitState = (Component) => {
return initStateRef.current[model].read();
}, []);
return (
<React.Suspense>
<React.Suspense fallback={<Fallback {...props} />}>
<GetInitStateContext.Provider value={getInitState}>
<Component {...props} />
</GetInitStateContext.Provider>