Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import { createSocket, initSocket } from './services/websocket';
import initNotifications from './services/notifications';
import createStore from './store';
import config from './config';
import theme from './assets/theme.json';
const socket = createSocket();
const store = createStore({ socket }); // Inject dependencies
initNotifications();
if (!config.IS_PROD) {
const makeInspectable = require('mobx-devtools-mst').default; // eslint-disable-line
makeInspectable(store);
}
initSocket({ store }); // Attach event listeners and inject dependencies
ReactDOM.render(
,
document.getElementById('root')
);
registerServiceWorker();
coreModules.forEach(mapModules);
pkgModules.forEach(mapModules);
// Create MST Stores
const Stores = Store.props(storesProps);
const { initialSelectedItem } = window['wp-pwa'];
stores = Stores.create(window['wp-pwa'].initialState, {
request,
machine: 'server',
...envs,
initialSelectedItem,
});
if (dev) {
const makeInspectable = require('mobx-devtools-mst').default;
makeInspectable(stores);
}
// Add both to window
if (typeof window !== 'undefined') window.frontity = { stores, components };
// Start all the client sagas.
stores.clientStarted();
// Initializes the beforeCSRs.
Object.values(stores).forEach(({ beforeCsr }) => {
if (beforeCsr) beforeCsr();
});
// Start App.
render(App);
// Inform that the client has been rendered.