How to use the redux-batched-actions.batchActions function in redux-batched-actions

To help you get started, we’ve selected a few redux-batched-actions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nus-mtp / cubist / src / webapp / middlewares / transitionMiddleware.js View on Github external
.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);
    });
};
github mattermost / mattermost-webapp / actions / websocket_actions.jsx View on Github external
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);
    };
}
github machawk1 / wail / wail-ui / actions / heritrix.js View on Github external
return dispatch => {
    dispatch(batchActions([updateRuns, updateJobIds]))
    dispatch(startJob(conf.jobId))
  }
}
github i-novus-llc / n2o-framework / frontend / n2o / src / components / widgets / Table / headers / TextTableHeader.jsx View on Github external
toggleVisibility: ({ dispatch, widgetId, columnId }) => visible => {
      dispatch(
        batchActions([
          changeColumnVisiblity(widgetId, columnId, visible),
          changeFrozenColumn(widgetId, columnId),
        ])
      );
    },
  }),
github mattermost / mattermost-mobile / app / actions / views / right_menu_drawer.js View on Github external
return async (dispatch, getState) => {
        dispatch(batchActions([{
            type: NavigationTypes.NAVIGATION_CLOSE_DRAWERS
        }, {
            type: NavigationTypes.NAVIGATION_PUSH,
            route: {
                ...Routes.Search,
                props: {
                    searchType: 'recent_mentions'
                }
            }
        }]), getState);
    };
}
github mattermost / mattermost-mobile / app / actions / views / select_server.js View on Github external
return async (dispatch, getState) => {
        dispatch(batchActions([
            {type: GeneralTypes.CLIENT_CONFIG_RESET},
            {type: GeneralTypes.CLIENT_LICENSE_RESET},
            {type: ViewTypes.SERVER_URL_CHANGED, serverUrl},
        ]), getState);
    };
}
github mattermost / mattermost-webapp / actions / file_actions.jsx View on Github external
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,
github mimorisuzuko / chain / src / containers / BlockCreator.jsx View on Github external
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()
		]));
	}
github Legitcode / scheduler / src / scheduler.jsx View on Github external
initializeStore(props) {
    const { resources, events, from, to } = props,
          range = new DateRange(from, to)

    store.dispatch(batchActions([
      setRange(range),
      replaceResources(resources),
      replaceEvents(events)
    ]))
  }
github zulip / zulip-mobile / src / events / eventActions.js View on Github external
export const dispatchOrBatch = (dispatch: Dispatch, actions: $ReadOnlyArray) => {
  if (actions.length > 1) {
    dispatch(batchActions(actions));
  } else if (actions.length === 1) {
    dispatch(actions[0]);
  }
};

redux-batched-actions

redux higher order reducer + action creator to reduce actions under a single subscriber notification

MIT
Latest version published 4 years ago

Package Health Score

50 / 100
Full package analysis