3
3
* External dependencies
4
4
*/
5
5
import { startsWith } from 'lodash' ;
6
- import React from 'react' ;
7
- import ReactDom from 'react-dom' ;
8
6
import store from 'store' ;
9
7
import page from 'page' ;
10
8
import debugFactory from 'debug' ;
@@ -31,22 +29,9 @@ import { setNextLayoutFocus, activateNextLayoutFocus } from 'state/ui/layout-foc
31
29
import Logger from 'lib/catch-js-errors' ;
32
30
import setupMySitesRoute from 'my-sites' ;
33
31
import setupGlobalKeyboardShortcuts from 'lib/keyboard-shortcuts/global' ;
34
- import * as controller from 'controller' ;
35
32
36
33
const debug = debugFactory ( 'calypso' ) ;
37
34
38
- function renderLayout ( reduxStore ) {
39
- const Layout = controller . ReduxWrappedLayout ;
40
-
41
- const layoutElement = React . createElement ( Layout , {
42
- store : reduxStore ,
43
- } ) ;
44
-
45
- ReactDom . render ( layoutElement , document . getElementById ( 'wpcom' ) ) ;
46
-
47
- debug ( 'Main layout rendered.' ) ;
48
- }
49
-
50
35
export const configureReduxStore = ( currentUser , reduxStore ) => {
51
36
debug ( 'Executing WordPress.com configure Redux store.' ) ;
52
37
@@ -74,38 +59,32 @@ export function setupMiddlewares( currentUser, reduxStore ) {
74
59
analytics . setSuperProps ( superProps ) ;
75
60
}
76
61
77
- // Render Layout only for non-isomorphic sections.
78
- // Isomorphic sections will take care of rendering their Layout last themselves.
79
- if ( ! document . getElementById ( 'primary' ) ) {
80
- renderLayout ( reduxStore ) ;
81
-
82
- if ( config . isEnabled ( 'catch-js-errors' ) ) {
83
- const errorLogger = new Logger ( ) ;
84
- //Save errorLogger to a singleton for use in arbitrary logging.
85
- require ( 'lib/catch-js-errors/log' ) . registerLogger ( errorLogger ) ;
86
- //Save data to JS error logger
87
- errorLogger . saveDiagnosticData ( {
88
- user_id : currentUser . get ( ) . ID ,
89
- calypso_env : config ( 'env_id' ) ,
90
- } ) ;
91
- errorLogger . saveDiagnosticReducer ( function ( ) {
92
- const state = reduxStore . getState ( ) ;
93
- return {
94
- blog_id : getSelectedSiteId ( state ) ,
95
- calypso_section : getSectionName ( state ) ,
96
- } ;
97
- } ) ;
98
- errorLogger . saveDiagnosticReducer ( ( ) => ( { tests : getSavedVariations ( ) } ) ) ;
99
- analytics . on ( 'record-event' , ( eventName , eventProperties ) =>
100
- errorLogger . saveExtraData ( { lastTracksEvent : eventProperties } )
62
+ if ( config . isEnabled ( 'catch-js-errors' ) && ! document . getElementById ( 'primary' ) ) {
63
+ const errorLogger = new Logger ( ) ;
64
+ //Save errorLogger to a singleton for use in arbitrary logging.
65
+ require ( 'lib/catch-js-errors/log' ) . registerLogger ( errorLogger ) ;
66
+ //Save data to JS error logger
67
+ errorLogger . saveDiagnosticData ( {
68
+ user_id : currentUser . get ( ) . ID ,
69
+ calypso_env : config ( 'env_id' ) ,
70
+ } ) ;
71
+ errorLogger . saveDiagnosticReducer ( function ( ) {
72
+ const state = reduxStore . getState ( ) ;
73
+ return {
74
+ blog_id : getSelectedSiteId ( state ) ,
75
+ calypso_section : getSectionName ( state ) ,
76
+ } ;
77
+ } ) ;
78
+ errorLogger . saveDiagnosticReducer ( ( ) => ( { tests : getSavedVariations ( ) } ) ) ;
79
+ analytics . on ( 'record-event' , ( eventName , eventProperties ) =>
80
+ errorLogger . saveExtraData ( { lastTracksEvent : eventProperties } )
81
+ ) ;
82
+ page ( '*' , function ( context , next ) {
83
+ errorLogger . saveNewPath (
84
+ context . canonicalPath . replace ( getSiteFragment ( context . canonicalPath ) , ':siteId' )
101
85
) ;
102
- page ( '*' , function ( context , next ) {
103
- errorLogger . saveNewPath (
104
- context . canonicalPath . replace ( getSiteFragment ( context . canonicalPath ) , ':siteId' )
105
- ) ;
106
- next ( ) ;
107
- } ) ;
108
- }
86
+ next ( ) ;
87
+ } ) ;
109
88
}
110
89
111
90
// If `?sb` or `?sp` are present on the path set the focus of layout
0 commit comments