How to use @wordpress/redux-routine - 1 common examples

To help you get started, we’ve selected a few @wordpress/redux-routine 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 WordPress / gutenberg / packages / data / src / namespace-store / index.js View on Github external
function createReduxStore( key, options, registry ) {
	const middlewares = [
		createResolversCacheMiddleware( registry, key ),
		promise,
	];

	if ( options.controls ) {
		const normalizedControls = mapValues( options.controls, ( control ) => {
			return control.isRegistryControl ? control( registry ) : control;
		} );
		middlewares.push( createReduxRoutineMiddleware( normalizedControls ) );
	}

	const enhancers = [
		applyMiddleware( ...middlewares ),
	];
	if ( typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ) {
		enhancers.push( window.__REDUX_DEVTOOLS_EXTENSION__( { name: key, instanceId: key } ) );
	}

	const { reducer, initialState } = options;
	const enhancedReducer = combineReducers( {
		metadata: metadataReducer,
		root: reducer,
	} );

	return createStore(

@wordpress/redux-routine

Redux middleware for generator coroutines.

GPL-2.0-or-later
Latest version published 15 days ago

Package Health Score

95 / 100
Full package analysis

Popular @wordpress/redux-routine functions