1
1
import config from '@automattic/calypso-config' ;
2
2
import page from '@automattic/calypso-router' ;
3
+ import { Step } from '@automattic/onboarding' ;
3
4
import * as LoadingError from 'calypso/layout/error' ;
5
+ import { isInStepContainerV2FlowContext } from 'calypso/layout/utils' ;
4
6
import { performanceTrackerStart } from 'calypso/lib/performance-tracking' ;
5
7
import { bumpStat } from 'calypso/state/analytics/actions' ;
6
8
import { setSectionLoading } from 'calypso/state/ui/actions' ;
@@ -86,6 +88,17 @@ function loadSectionHandler( sectionDefinition ) {
86
88
} ;
87
89
}
88
90
91
+ function emptyPageLoading ( context , next ) {
92
+ if ( ! isInStepContainerV2FlowContext ( context . pathname , context . querystring ) ) {
93
+ return next ( ) ;
94
+ }
95
+
96
+ context . layout = < Step . Loading /> ;
97
+ controller . render ( context ) ;
98
+
99
+ next ( ) ;
100
+ }
101
+
89
102
function createPageDefinition ( path , sectionDefinition ) {
90
103
// skip this section if it's not enabled in current environment
91
104
const { envId } = sectionDefinition ;
@@ -106,6 +119,10 @@ function createPageDefinition( path, sectionDefinition ) {
106
119
handler = composeHandlers ( controller . redirectLoggedOut , handler ) ;
107
120
}
108
121
122
+ if ( path === '/checkout' ) {
123
+ handler = composeHandlers ( emptyPageLoading , handler ) ;
124
+ }
125
+
109
126
page ( pathRegex , handler ) ;
110
127
}
111
128
0 commit comments