File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,7 +86,14 @@ initSocket();
8686 location : history . location
8787 } ;
8888
89- await trigger ( 'fetch' , components , triggerLocals ) ;
89+ // Don't fetch data for initial route, server has already done the work:
90+ if ( window . __PRELOADED__ ) {
91+ // Delete initial data so that subsequent data fetches can occur:
92+ delete window . __PRELOADED__ ;
93+ } else {
94+ // Fetch mandatory data dependencies for 2nd route change onwards:
95+ await trigger ( 'fetch' , components , triggerLocals ) ;
96+ }
9097 await trigger ( 'defer' , components , triggerLocals ) ;
9198
9299 ReactDOM . hydrate (
Original file line number Diff line number Diff line change @@ -59,7 +59,9 @@ const Html = ({
5959 < div id = "content" dangerouslySetInnerHTML = { { __html : content } } />
6060 { store && (
6161 < script
62- dangerouslySetInnerHTML = { { __html : `window.__data=${ serialize ( store . getState ( ) ) } ;` } }
62+ dangerouslySetInnerHTML = { {
63+ __html : `window.__PRELOADED__=true;window.__data=${ serialize ( store . getState ( ) ) } ;`
64+ } }
6365 charSet = "UTF-8"
6466 />
6567 ) }
You can’t perform that action at this time.
0 commit comments