1313
1414< % if ( ctx . mode . ssr && ctx . mode . pwa ) { % >
1515import { createSSRApp , createApp } from 'vue'
16- import { isRunningOnPWA } from './ssr-pwa'
1716< % } else { % >
1817import { < %= ctx . mode . ssr ? 'createSSRApp' : 'createApp' % > } from 'vue'
1918< % } % >
@@ -45,7 +44,7 @@ import 'quasar/src/css/flex-addon.<%= metaConf.css.quasarSrcExt %>'
4544import '<%= asset.path %>'
4645< % } ) % >
4746
48- import createQuasarApp from './app.js'
47+ import createQuasarApp < % if ( ctx . mode . ssr && ctx . mode . pwa ) { % > , { ssrIsRunningOnClientPWA } < % } % > from '. / app . js '
4948import quasarUserOptions from '. / quasar - user - options . js '
5049
5150< % if ( ctx . mode . pwa ) { % >
@@ -71,20 +70,16 @@ if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && window.n
7170
7271const publicPath = `< %= build . publicPath % > `
7372
74- async function start ( { app, router < %= store ? ', store, storeKey' : '' % > } < %= bootEntries . length > 0 ? ', bootFiles' : '' % > ) {
75- < % if ( ctx . mode . ssr && store && ssr . manualStoreHydration !== true ) { % >
73+ async function start ({
74+ app ,
75+ router
76+ < %= store ? ', store' + ( metaConf . storePackage === 'vuex' ? ', storeKey' : '' ) : '' % >
77+ } < %= bootEntries . length > 0 ? ', bootFiles' : '' %> ) {
78+ < % if ( ctx . mode . ssr && store && metaConf . storePackage === 'vuex' && ssr . manualStoreHydration !== true ) { % >
7679 // prime the store with server-initialized state.
7780 // the state is determined during SSR and inlined in the page markup.
78- if ( < % if ( ctx . mode . pwa ) { % > isRunningOnPWA !== true && < % } % > window.__INITIAL_STATE__ !== void 0) {
79- if ( typeof store . replaceState === 'function' ) {
80- // it means it's Vuex
81- store . replaceState ( window . __INITIAL_STATE__ )
82- }
83- else {
84- // it means it's Pinia
85- store . state . value = window . __INITIAL_STATE__
86- }
87-
81+ if ( < %= ctx . mode . pwa ? 'ssrIsRunningOnClientPWA !== true &&' : '' % > window . __INITIAL_STATE__ !== void 0 ) {
82+ store . replaceState ( window . __INITIAL_STATE__ )
8883 // for security reasons, we'll delete this
8984 delete window . __INITIAL_STATE__
9085 }
@@ -148,13 +143,13 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
148143 < % } % >
149144
150145 app.use(router)
151- < % if ( store ) { % > app.use(store, storeKey)< % } % >
146+ < % if ( store && metaConf . storePackage = = = 'vuex' ) { % > app.use(store, storeKey)< % } % >
152147
153148 < % if ( ctx . mode . ssr ) { % >
154149 < % if ( ctx . mode . pwa ) { % >
155- if (isRunningOnPWA === true) {
150+ if (ssrIsRunningOnClientPWA === true) {
156151 < % if ( preFetch ) { % >
157- addPreFetchHooks ( router < %= store ? ', store' : '' % > )
152+ addPreFetchHooks ( { router, ssrIsRunningOnClientPWA < %= store ? ', store' : '' % > } )
158153 < % } %>
159154 app . mount ( '#q- app ')
160155 }
@@ -164,7 +159,7 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
164159 // and async components...
165160 router . isReady ( ) . then ( ( ) => {
166161 < % if ( preFetch ) { % >
167- addPreFetchHooks ( router < %= store ? ', store' : '' % > , publicPath )
162+ addPreFetchHooks ( { router < %= store ? ', store' : '' % > , publicPath } )
168163 < % } %>
169164 app . mount ( '#q- app ')
170165 } )
@@ -175,7 +170,7 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
175170 < % } else { // not SSR %>
176171
177172 < % if ( preFetch ) { % >
178- addPreFetchHooks ( router < %= store ? ', store' : '' % > )
173+ addPreFetchHooks ( { router < %= store ? ', store' : '' % > } )
179174 < % } %>
180175
181176 < % if ( ctx . mode . cordova ) { % >
@@ -262,7 +257,7 @@ async function start ({ app, router<%= store ? ', store, storeKey' : '' %> }<%=
262257
263258createQuasarApp ( < %=
264259 ctx . mode . ssr
265- ? ( ctx . mode . pwa ? 'isRunningOnPWA ? createApp : createSSRApp ' : 'createSSRApp ')
260+ ? ( ctx . mode . pwa ? 'ssrIsRunningOnClientPWA ? createApp : createSSRApp ' : 'createSSRApp ')
266261 : 'createApp '
267262% > , quasarUserOptions)
268263< % if ( bootEntries . length > 0) { % >
0 commit comments