Skip to content

Commit

Permalink
fix: fixed dispatchAction
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Apr 9, 2021
1 parent a228571 commit fa58567
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ export default (config) => {
{
path: '/',
extend: (dispatchActions) => {
dispatchActions.push({
key: 'secondary-menu',
promise: ({ location, store: { dispatch } }) =>
__SERVER__ && dispatch(getSecondaryMenu()),
});
if (
dispatchActions.filter(
(asyncAction) => asyncAction.key === 'secondary-menu',
).length === 0
) {
dispatchActions.push({
key: 'secondary-menu',
promise: ({ location, store: { dispatch } }) =>
__SERVER__ && dispatch(getSecondaryMenu()),
});
}

return dispatchActions;
},
Expand Down

0 comments on commit fa58567

Please sign in to comment.