How to use the @talend/react-cmf.store.initialize function in @talend/react-cmf

To help you get started, we’ve selected a few @talend/react-cmf 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 Talend / data-prep / dataprep-webapp / src / app / configure.cmf.js View on Github external
let reducers = {};
		const additionalReducers = additionalConfiguration.reducers;
		if (additionalReducers) {
			reducers = {
				...additionalReducers,
			};
		}

		const sagaMiddleware = createSagaMiddleware();
		const middlewares = [sagaMiddleware];
		const additionalMiddlewares = additionalConfiguration.middlewares;
		if (additionalMiddlewares) {
			middlewares.push(...additionalMiddlewares);
		}

		const store = cmfStore.initialize(reducers, initialState, undefined, middlewares);

		sagaMiddleware.run(rootSaga);

		api.registerInternals();

		/**
		 * Register route functions
		 */
		const additionalRouteFunctions = additionalConfiguration.routeFunctions;
		if (additionalRouteFunctions) {
			Object.keys(additionalRouteFunctions).map(k =>
				registerRouteFunction(k, additionalRouteFunctions[k]),
			);
		}

		registerAllContainers();
github Talend / data-prep / dataprep-webapp-cmf / src / app / index.js View on Github external
* - Register your components in the CMF dictionary
 * - Register action creators in CMF actions dictionary
 */
configure.initialize();

/**
 * Register react-router-redux router reducer (see https://github.com/reactjs/react-router-redux)
 */
const history = createHistory();
cmfstore.setRouterMiddleware(routerMiddleware(history));

/**
 * Register your app reducers
 */
const sagaMiddleware = createSagaMiddleware();
const store = cmfstore.initialize(appReducer, undefined, undefined, [sagaMiddleware]);

/**
 * Run main saga
 */
configure.runSagas(sagaMiddleware, history);

/**
 * Fetch the CMF settings and configure the CMF app
 */
store.dispatch(actions.settings.fetchSettings('/settings.json'));

/**
 * Render the CMF App
 */
render(
	,
github Talend / data-prep / dataprep-webapp / src / app / configure.cmf.js View on Github external
let reducers = {};
	const additionalReducers = additionalConfiguration.reducers;
	if (additionalReducers) {
		reducers = {
			...additionalReducers,
		};
	}

	const sagaMiddleware = createSagaMiddleware();
	const middlewares = [sagaMiddleware];
	const additionalMiddlewares = additionalConfiguration.middlewares;
	if (additionalMiddlewares) {
		middlewares.push(...additionalMiddlewares);
	}

	const store = cmfStore.initialize(reducers, preloadedState, undefined, middlewares);

	sagaMiddleware.run(rootSaga);

	api.registerInternals();

	/**
	 * Register route functions
	 */
	const additionalRouteFunctions = additionalConfiguration.routeFunctions;
	if (additionalRouteFunctions) {
		Object.keys(additionalRouteFunctions).map(k =>
			registerRouteFunction(k, additionalRouteFunctions[k]),
		);
	}

	registerAllContainers();
github Talend / ui / packages / storybook-cmf / src / CMFStory / CMFStory.component.js View on Github external
constructor(props) {
		super(props);
		let state;
		if (props) {
			state = props.state;
		}
		if (!state) {
			state = mock.state();
		}

		let middlewares = this.props.middleware;
		if (props.sagaMiddleware) {
			middlewares = middlewares.concat([props.sagaMiddleware]);
		}
		this.store = store.initialize(props.reducer, state, props.enhancer, middlewares);
		if (props.sagaMiddleware) {
			api.registerInternals();
			props.sagaMiddleware.run(initSagaMiddleWare);
		}
	}