Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(() => {
const { RequestStore } = getState();
const actions = RequestStore
.get('navigateMap')
.get(RequestStore.get('navigateId'))
.toJS();
dispatch(batchActions([
...actions,
{ type: NAVIGATE_COMPLETE },
action
]));
// Scroll to top after transition
window.scrollTo(0, 0);
});
};
return (myDispatch, myGetState) => {
const posts = queue.map((msg) => JSON.parse(msg.data.post));
// Receive the posts as one continuous block since they were received within a short period
const actions = posts.map(receivedNewPost);
myDispatch(batchActions(actions));
// Load the posts' threads
myDispatch(getThreadsForPosts(posts));
// And any other data needed for them
getProfilesAndStatusesForPosts(posts, myDispatch, myGetState);
};
}
return dispatch => {
dispatch(batchActions([updateRuns, updateJobIds]))
dispatch(startJob(conf.jobId))
}
}
toggleVisibility: ({ dispatch, widgetId, columnId }) => visible => {
dispatch(
batchActions([
changeColumnVisiblity(widgetId, columnId, visible),
changeFrozenColumn(widgetId, columnId),
])
);
},
}),
return async (dispatch, getState) => {
dispatch(batchActions([{
type: NavigationTypes.NAVIGATION_CLOSE_DRAWERS
}, {
type: NavigationTypes.NAVIGATION_PUSH,
route: {
...Routes.Search,
props: {
searchType: 'recent_mentions'
}
}
}]), getState);
};
}
return async (dispatch, getState) => {
dispatch(batchActions([
{type: GeneralTypes.CLIENT_CONFIG_RESET},
{type: GeneralTypes.CLIENT_LICENSE_RESET},
{type: ViewTypes.SERVER_URL_CHANGED, serverUrl},
]), getState);
};
}
export default function configureServiceStore(preloadedState, appReducer) {
const baseReducer = combineReducers(Object.assign({}, serviceReducer, appReducer));
return createStore(
enableBatching(baseReducer),
preloadedState,
applyMiddleware(thunk)
);
}
export default function configureStore(API) {
const callAPIMiddleware = getAPIMiddleware(API);
const middleware = [
callAPIMiddleware,
throwOnAsyncErrorMiddleware,
thunkMiddleware,
batchDispatchMiddleware,
];
return createStore(enableBatching(reducer), applyMiddleware(...middleware));
}
function createReducer(...reducers) {
const baseReducer = combineReducers(Object.assign({}, ...reducers));
return enableFreezing(enableBatching(baseReducer));
}
function getReducer(appReducer) {
let reducerObject = {};
if (appReducer) {
if (typeof appReducer === 'object') {
reducerObject = Object.assign({}, appReducer);
} else if (typeof appReducer === 'function') {
reducerObject = { app: appReducer };
}
} else {
invariant(true, 'Are you sure you want to bootstrap an app without reducers ?');
}
if (!reducerObject.cmf) {
reducerObject.cmf = cmfReducers;
}
return enableBatching(preApplyReducer(combineReducers(reducerObject)));
}