Feat: Welcome Page (#17150)
This commit is contained in:
committed by
mrugesh mohapatra
parent
47bb4ca5e3
commit
156ea1af76
@@ -4,20 +4,13 @@ import Rx from 'rx';
|
||||
import debug from 'debug';
|
||||
import { render } from 'redux-epic';
|
||||
import createHistory from 'history/createBrowserHistory';
|
||||
import useLangRoutes from './utils/use-lang-routes';
|
||||
import sendPageAnalytics from './utils/send-page-analytics';
|
||||
|
||||
import { App, createApp, provideStore } from '../common/app';
|
||||
import { getLangFromPath } from '../common/app/utils/lang';
|
||||
|
||||
// client specific epics
|
||||
import epics from './epics';
|
||||
|
||||
import {
|
||||
isColdStored,
|
||||
getColdStorage,
|
||||
saveToColdStorage
|
||||
} from './cold-reload';
|
||||
|
||||
const {
|
||||
__OPBEAT__ORG_ID,
|
||||
@@ -47,7 +40,7 @@ const {
|
||||
document,
|
||||
ga,
|
||||
__fcc__: {
|
||||
data: ssrState = {},
|
||||
data: defaultState = {},
|
||||
csrf: {
|
||||
token: csrfToken
|
||||
} = {}
|
||||
@@ -63,10 +56,6 @@ const epicOptions = {
|
||||
|
||||
|
||||
const DOMContainer = document.getElementById('fcc');
|
||||
const defaultState = isColdStored() ?
|
||||
getColdStorage() :
|
||||
ssrState;
|
||||
const primaryLang = getLangFromPath(location.pathname);
|
||||
|
||||
defaultState.app.csrfToken = csrfToken;
|
||||
|
||||
@@ -76,7 +65,7 @@ const serviceOptions = {
|
||||
xhrTimeout: 15000
|
||||
};
|
||||
|
||||
const history = useLangRoutes(createHistory, primaryLang)();
|
||||
const history = createHistory();
|
||||
sendPageAnalytics(history, ga);
|
||||
|
||||
createApp({
|
||||
@@ -88,14 +77,13 @@ createApp({
|
||||
enhancers: isDev && devToolsExtension && [ devToolsExtension() ],
|
||||
middlewares: enableOpbeat && [ createOpbeatMiddleware() ]
|
||||
})
|
||||
.doOnNext(({ store }) => {
|
||||
.doOnNext(() => {
|
||||
if (module.hot && typeof module.hot.accept === 'function') {
|
||||
module.hot.accept(() => {
|
||||
// note(berks): not sure this ever runs anymore after adding
|
||||
// RHR?
|
||||
log('saving state and refreshing.');
|
||||
log('ignore react ssr warning.');
|
||||
saveToColdStorage(store.getState());
|
||||
setTimeout(() => location.reload(), hotReloadTimeout);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user