Changeset View
Changeset View
Standalone View
Standalone View
web/root.js
// @flow | // @flow | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { Provider } from 'react-redux'; | import { Provider } from 'react-redux'; | ||||
import { Router, Route } from 'react-router'; | import { Router, Route } from 'react-router'; | ||||
import { createStore, applyMiddleware, type Store } from 'redux'; | import { createStore, applyMiddleware, type Store } from 'redux'; | ||||
import { composeWithDevTools } from 'redux-devtools-extension/logOnlyInProduction.js'; | import { composeWithDevTools } from 'redux-devtools-extension/logOnlyInProduction.js'; | ||||
import { createMigrate, persistReducer, persistStore } from 'redux-persist'; | import { createMigrate, persistReducer, persistStore } from 'redux-persist'; | ||||
import { PersistGate } from 'redux-persist/es/integration/react.js'; | import { PersistGate } from 'redux-persist/es/integration/react.js'; | ||||
import storage from 'redux-persist/es/storage/index.js'; | import storage from 'redux-persist/es/storage/index.js'; | ||||
import thunk from 'redux-thunk'; | import thunk from 'redux-thunk'; | ||||
import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; | import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; | ||||
import { isDev } from 'lib/utils/dev-utils.js'; | import { isDev } from 'lib/utils/dev-utils.js'; | ||||
import App from './app.react.js'; | import App from './app.react.js'; | ||||
import { SQLiteDataHandler } from './database/sqlite-data-handler.js'; | |||||
import ErrorBoundary from './error-boundary.react.js'; | import ErrorBoundary from './error-boundary.react.js'; | ||||
import Loading from './loading.react.js'; | import Loading from './loading.react.js'; | ||||
import { reducer } from './redux/redux-setup.js'; | import { reducer } from './redux/redux-setup.js'; | ||||
import type { AppState, Action } from './redux/redux-setup.js'; | import type { AppState, Action } from './redux/redux-setup.js'; | ||||
import history from './router-history.js'; | import history from './router-history.js'; | ||||
import Socket from './socket.react.js'; | import Socket from './socket.react.js'; | ||||
const migrations = { | const migrations = { | ||||
Show All 40 Lines | |||||
const RootProvider = (): React.Node => ( | const RootProvider = (): React.Node => ( | ||||
<Provider store={store}> | <Provider store={store}> | ||||
<PersistGate persistor={persistor} loading={<Loading />}> | <PersistGate persistor={persistor} loading={<Loading />}> | ||||
<ErrorBoundary> | <ErrorBoundary> | ||||
<Router history={history.getHistoryObject()}> | <Router history={history.getHistoryObject()}> | ||||
<Route path="*" component={App} /> | <Route path="*" component={App} /> | ||||
</Router> | </Router> | ||||
<Socket /> | <Socket /> | ||||
<SQLiteDataHandler /> | |||||
</ErrorBoundary> | </ErrorBoundary> | ||||
</PersistGate> | </PersistGate> | ||||
</Provider> | </Provider> | ||||
); | ); | ||||
export default RootProvider; | export default RootProvider; |