extract store from configurestore

This commit is contained in:
Peter Holmberg
2018-11-05 16:54:48 +01:00
parent 6dc3e0399d
commit ffc06e9962
9 changed files with 15 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
import { store } from 'app/store/configureStore';
import { store } from 'app/store/store';
import locationUtil from 'app/core/utils/location_util';
import { updateLocation } from 'app/core/actions';
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import { store } from '../../store/configureStore';
import { store } from '../../store/store';
export function connectWithStore(WrappedComponent, ...args) {
const ConnectedWrappedComponent = connect(...args)(WrappedComponent);
@@ -2,7 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import { PanelModel } from '../panel_model';
import { DashboardModel } from '../dashboard_model';
import { store } from 'app/store/configureStore';
import { store } from 'app/store/store';
import { QueriesTab } from './QueriesTab';
import { PanelPlugin, PluginExports } from 'app/types/plugins';
import { VizTypePicker } from './VizTypePicker';
@@ -2,7 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import { PanelModel } from '../panel_model';
import { DashboardModel } from '../dashboard_model';
import { store } from 'app/store/configureStore';
import { store } from 'app/store/store';
import { updateLocation } from 'app/core/actions';
interface PanelHeaderProps {
@@ -1,5 +1,5 @@
import { coreModule } from 'app/core/core';
import { store } from 'app/store/configureStore';
import { store } from 'app/store/store';
import { getNavModel } from 'app/core/selectors/navModel';
import { buildNavModel } from './state/navModel';
+1 -1
View File
@@ -1,7 +1,7 @@
import _ from 'lodash';
import config from 'app/core/config';
import { coreModule, appEvents } from 'app/core/core';
import { store } from 'app/store/configureStore';
import { store } from 'app/store/store';
import { getNavModel } from 'app/core/selectors/navModel';
import { buildNavModel } from './state/navModel';
+1 -1
View File
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import coreModule from 'app/core/core_module';
import { store } from 'app/store/configureStore';
import { store } from 'app/store/store';
import { BackendSrv } from 'app/core/services/backend_srv';
import { DatasourceSrv } from 'app/features/plugins/datasource_srv';
import { ContextSrv } from 'app/core/services/context_srv';
+3 -4
View File
@@ -11,6 +11,7 @@ import pluginReducers from 'app/features/plugins/state/reducers';
import dataSourcesReducers from 'app/features/datasources/state/reducers';
import usersReducers from 'app/features/users/state/reducers';
import organizationReducers from 'app/features/org/state/reducers';
import { setStore } from './store';
const rootReducers = {
...sharedReducers,
@@ -25,8 +26,6 @@ const rootReducers = {
...organizationReducers,
};
export let store;
export function addRootReducer(reducers) {
Object.assign(rootReducers, ...reducers);
}
@@ -38,8 +37,8 @@ export function configureStore() {
if (process.env.NODE_ENV !== 'production') {
// DEV builds we had the logger middleware
store = createStore(rootReducer, {}, composeEnhancers(applyMiddleware(thunk, createLogger())));
setStore(createStore(rootReducer, {}, composeEnhancers(applyMiddleware(thunk, createLogger()))));
} else {
store = createStore(rootReducer, {}, composeEnhancers(applyMiddleware(thunk)));
setStore(createStore(rootReducer, {}, composeEnhancers(applyMiddleware(thunk))));
}
}
+5
View File
@@ -0,0 +1,5 @@
export let store;
export function setStore(newStore) {
store = newStore;
}