1212
1313< % if ( ctx . mode . ssr && ctx . mode . pwa ) { % >
1414import { createSSRApp , createApp } from 'vue'
15- import { isRunningOnPWA } from './ssr-pwa'
1615< % } else { % >
1716import { < %= ctx . mode . ssr ? 'createSSRApp' : 'createApp' % > } from 'vue'
1817< % } % >
@@ -44,7 +43,7 @@ import 'quasar/src/css/flex-addon.<%= __css.quasarSrcExt %>'
4443import '<%= asset.path %>'
4544< % } ) % >
4645
47- import createQuasarApp from './app.js'
46+ import createQuasarApp < % if ( ctx . mode . ssr && ctx . mode . pwa ) { % > , { ssrIsRunningOnClientPWA } < % } % > from '. / app . js '
4847import quasarUserOptions from '. / quasar - user - options . js '
4948
5049< % if ( ctx . mode . pwa ) { % >
@@ -75,23 +74,19 @@ const doubleSlashRE = /\/\//
7574const addPublicPath = url => ( publicPath + url ) . replace ( doubleSlashRE , '/' )
7675< % } %>
7776
78- async function start ( { app, router < %= store ? ', store, storeKey' : '' % > } < %= bootEntries . length > 0 ? ', bootFiles' : '' % > ) {
79- < % if ( ctx . mode . ssr && store && ssr . manualStoreHydration !== true ) { % >
80- // prime the store with server-initialized state.
81- // the state is determined during SSR and inlined in the page markup.
82- if ( < % if ( ctx . mode . pwa ) { % > isRunningOnPWA !== true && < % } % > window.__INITIAL_STATE__ !== void 0) {
83- if ( typeof store . replaceState === 'function' ) {
84- // it means it's Vuex
77+ async function start ( {
78+ app ,
79+ router
80+ < %= store ? ', store' + ( __storePackage === 'vuex' ? ', storeKey' : '' ) : '' % >
81+ } < %= bootEntries . length > 0 ? ', bootFiles' : '' %> ) {
82+ < % if ( ctx . mode . ssr && store && __storePackage === 'vuex' && ssr . manualStoreHydration !== true ) { % >
83+ // prime the store with server-initialized state.
84+ // the state is determined during SSR and inlined in the page markup.
85+ if ( < %= ctx . mode . pwa ? 'ssrIsRunningOnClientPWA !== true &&' : '' % > window . __INITIAL_STATE__ !== void 0 ) {
8586 store . replaceState ( window . __INITIAL_STATE__ )
87+ // for security reasons, we'll delete this
88+ delete window . __INITIAL_STATE__
8689 }
87- else {
88- // it means it's Pinia
89- store . state . value = window . __INITIAL_STATE__
90- }
91-
92- // for security reasons, we'll delete this
93- delete window.__INITIAL_STATE__
94- }
9590 < % } % >
9691
9792 < % if ( bootEntries . length > 0) { % >
@@ -152,13 +147,13 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
152147 < % } % >
153148
154149 app.use(router)
155- < % if ( store ) { % > app.use(store, storeKey)< % } % >
150+ < % if ( store && __storePackage = = = 'vuex' ) { % > app.use(store, storeKey)< % } % >
156151
157152 < % if ( ctx . mode . ssr ) { % >
158153 < % if ( ctx . mode . pwa ) { % >
159- if (isRunningOnPWA === true) {
154+ if (ssrIsRunningOnClientPWA === true) {
160155 < % if ( preFetch ) { % >
161- addPreFetchHooks ( router < %= store ? ', store' : '' % > )
156+ addPreFetchHooks ( { router, ssrIsRunningOnClientPWA < %= store ? ', store' : '' % > } )
162157 < % } %>
163158 app . mount ( '#q- app ')
164159 }
@@ -168,7 +163,7 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
168163 // and async components...
169164 router . isReady ( ) . then ( ( ) => {
170165 < % if ( preFetch ) { % >
171- addPreFetchHooks ( router < %= store ? ', store' : '' % > , publicPath )
166+ addPreFetchHooks ( { router < %= store ? ', store' : '' % > , publicPath } )
172167 < % } %>
173168 app . mount ( '#q- app ')
174169 } )
@@ -179,7 +174,7 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
179174 < % } else { // not SSR %>
180175
181176 < % if ( preFetch ) { % >
182- addPreFetchHooks ( router < %= store ? ', store' : '' % > )
177+ addPreFetchHooks ( { router < %= store ? ', store' : '' % > } )
183178 < % } %>
184179
185180 < % if ( ctx . mode . cordova ) { % >
@@ -266,7 +261,7 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
266261
267262createQuasarApp ( < %=
268263 ctx . mode . ssr
269- ? ( ctx . mode . pwa ? 'isRunningOnPWA ? createApp : createSSRApp ' : 'createSSRApp ')
264+ ? ( ctx . mode . pwa ? 'ssrIsRunningOnClientPWA ? createApp : createSSRApp ' : 'createSSRApp ')
270265 : 'createApp '
271266% > , quasarUserOptions)
272267< % if ( bootEntries . length > 0) { % >
0 commit comments