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);
};
}
e = {message: Utils.localizeMessage('channel_loader.connection_error', 'There appears to be a problem with your internet connection.')};
} else {
e = {message: Utils.localizeMessage('channel_loader.unknown_error', 'We received an unexpected status code from the server.') + ' (' + err.status + ')'};
}
forceLogoutIfNecessary(err, dispatch, getState);
const failure = {
type: FileTypes.UPLOAD_FILES_FAILURE,
clientIds: [clientId],
channelId,
rootId: null,
error: err,
};
dispatch(batchActions([failure, getLogErrorAction(err)]), getState);
if (errorCallback) {
errorCallback(e);
}
} else if (res) {
const data = res.body.file_infos.map((fileInfo, index) => {
return {
...fileInfo,
clientId: res.body.client_ids[index],
};
});
dispatch(batchActions([
{
type: FileTypes.RECEIVED_UPLOAD_FILES,
data,
onClick() {
const { props: { model, dispatch } } = this;
dispatch(batchActions([
actions.addBlock({ x: model.get('x'), y: model.get('y'), value: _.trim(model.get('value')), type: model.get('selected') }),
actions.toggleBlockCreator()
]));
}
initializeStore(props) {
const { resources, events, from, to } = props,
range = new DateRange(from, to)
store.dispatch(batchActions([
setRange(range),
replaceResources(resources),
replaceEvents(events)
]))
}
export const dispatchOrBatch = (dispatch: Dispatch, actions: $ReadOnlyArray) => {
if (actions.length > 1) {
dispatch(batchActions(actions));
} else if (actions.length === 1) {
dispatch(actions[0]);
}
};