Skip to content

Commit 934a3ca

Browse files
authored
Merge pull request #6 from recruit-tech/fix-dispatch-skip-action
fix(loadOnServer): dispatch skip action if no asyncLoader()
2 parents 35efd80 + 37c0f93 commit 934a3ca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/loadOnServer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { beginAsyncLoad, endAsyncLoad } from './actions';
1+
import { beginAsyncLoad, endAsyncLoad, skipAsyncLoad } from './actions';
22
import flattenComponents from './flattenComponents';
33
import loadAsync from './loadAsync';
44

55
export default function loadOnServer(renderProps, store) {
6+
const { dispatch } = store;
7+
68
const flattened = flattenComponents(renderProps.components);
79
if (!flattened.length) {
10+
dispatch(skipAsyncLoad(true));
811
return Promise.resolve();
912
}
1013

11-
const { dispatch } = store;
1214
dispatch(beginAsyncLoad(true));
1315
return loadAsync(flattened, renderProps, store).then(
1416
(v) => {

0 commit comments

Comments
 (0)