diff --git a/web/renderer/+onRenderClient.ts b/web/renderer/+onRenderClient.ts index 50828f82..8a294a2b 100644 --- a/web/renderer/+onRenderClient.ts +++ b/web/renderer/+onRenderClient.ts @@ -14,11 +14,6 @@ export { onRenderClient } async function onRenderClient(pageContext: PageContext) { const params = createApp(pageContext) - initSentry(pageContext.envConfig.sentryDsn, params.app, params.router) - hydrate(params.queryClient, pageContext.vueQueryState) - params.pinia.state.value = SuperJSON.parse(pageContext.piniaState) - await params.router.isReady() - const { registerSW } = await import('virtual:pwa-register') // use dynamic import to fetch sw at runtime registerSW({ immediate: true, // reload app when service worker updates @@ -29,5 +24,12 @@ async function onRenderClient(pageContext: PageContext) { }) }, }) + + initSentry(pageContext.envConfig.sentryDsn, params.app, params.router) + hydrate(params.queryClient, pageContext.vueQueryState) + params.pinia.state.value = SuperJSON.parse(pageContext.piniaState) + + await params.router.isReady() + params.app.mount('#app') } diff --git a/web/renderer/app.ts b/web/renderer/app.ts index 9c3e1d0b..c50fce3d 100644 --- a/web/renderer/app.ts +++ b/web/renderer/app.ts @@ -71,7 +71,7 @@ function createApp(pageContext: PageContext) { }, ], link: [ - { rel: 'manifest', href: '/manifest.webmanifest' }, + { rel: 'manifest', href: '/manifest.webmanifest' }, // TODO try https://vite-pwa-org.netlify.app/frameworks/#accessing-pwa-info instead { rel: 'icon', href: '/icons/favicon.ico', sizes: 'any' }, { rel: 'icon', href: '/icons/favicon.svg', type: 'image/svg+xml' }, { rel: 'apple-touch-icon', href: '/icons/icon_x512.png', sizes: '512x512' }, diff --git a/web/vite.config.ts b/web/vite.config.ts index 2ff5e074..c9054c1a 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -41,7 +41,7 @@ const config: UserConfig = { resolver: 'vue', }), VitePWA({ - injectRegister: null, // not supported by vike, injected in all.page.client instead + injectRegister: null, // not supported by vike, injected in +onRenderClient.ts instead registerType: 'autoUpdate', devOptions: { enabled: false,