Closed userquin closed 2 years ago
On Chrome on android also with the same problem.
Al so failing on Windows 10 Home Edition on Firefox.
I'm using vue Teleport
...
vitepress.vuejs.org is also deployed on netlify, but it doesn't seem to have this problem
I'm using vue
Teleport
...
Similar issue https://github.com/vuepress/vuepress-next/issues/127.
I'm afraid VitePress does not handle teleport SSR as well.
The problem is related to the Teleport, I need to add the ReloadPrompt
component twice, since we don't have a Layout
slot, so I need to add it to some Home
slot and also to some Content
slot, and so when switching between pages there are 2 Teleport.
Maybe when Layout
slots added and adding the component only once should work... I'll try it patching the VitePress Layout
component...
@meteorlxy it seems to be not related to SSR, patching the Layout with the slots on https://github.com/vuejs/vitepress/issues/760 and adding the ReloadPrompt
component only once using layout-bottom
slot works.
The patch is quite simple, just adding this vite plugin:
{
name: 'vitepress-layout-slots-fix',
enforce: 'pre',
transform(code, id) {
if (id.includes('Layout.vue') && !id.endsWith('.css'))
return code.replace('<VPFooter />', '<VPFooter />\n<slot name="layout-bottom" />')
},
}
Now the Netlify preview works again: https://deploy-preview-304--vite-plugin-pwa.netlify.app/
Describe the bug
Fails on
alpha-1
and onalpha-2
.When navigating from Home page to
Get Started
page, all content pages appers under thesidebar
, check first screenshot below.If I refresh the page, all pages seems to be ok, but if I click on the sidebar title, then the
Home
page is wrong, check last screnshot.I have tested the build with and without the PWA resulting in the same error.
The problem seems to be only on Windows 10 PRO, with development options enabled (on MacOS works), tested on private window on:
Reproduction
You can check a preview on Netlify here: https://deploy-preview-304--vite-plugin-pwa.netlify.app/
Clone this branch https://github.com/antfu/vite-plugin-pwa/tree/userquin/feat-new-theme
Before running the docs install deps and build the plugin, from root folder run:
pnpm install && pnpm run build
To run the docs on dev run from root folder:
pnpm run docs
.To build and run the docs using vitepress preview, run from root folder:
pnpm run docs:preview
.To build and run the docs using https, run from root folder:
pnpm run docs:serve
(will ask for creating and installing a TLS certificate forlocalhost
viahttps-localhost
dependency).On dev it works as expected, but building and serving via
serve dist
orvitepress serve
the problem is there on both cases.To disable the PWA, just go to
https://github.com/antfu/vite-plugin-pwa/blob/userquin/feat-new-theme/docs/vite.config.ts#L47
and adddisable: true
onVitePWA
plugin:Expected behavior
The pages should work as expected
System Info
Additional context
There is an
hydration error
and aTypeError
:Errors loading Home page and navigating to Get Started
```ts Hydration completed but contains mismatches. f @ app.5ad12325.js:1 app.5ad12325.js:1 TypeError: Cannot read properties of null (reading 'parentNode') at remove (app.5ad12325.js:1:55339) at Object.remove (app.5ad12325.js:1:48276) at nt (app.5ad12325.js:1:45370) at Ii (app.5ad12325.js:1:45984) at nt (app.5ad12325.js:1:45260) at Qe (app.5ad12325.js:1:46221) at nt (app.5ad12325.js:1:45457) at Qe (app.5ad12325.js:1:46221) at nt (app.5ad12325.js:1:45457) at Qe (app.5ad12325.js:1:46221) Hc @ app.5ad12325.js:1 Wo @ app.5ad12325.js:1 pt @ app.5ad12325.js:1 Wr @ app.5ad12325.js:1 Promise.then (async) Ur @ app.5ad12325.js:1 jr @ app.5ad12325.js:1 (anonymous) @ app.5ad12325.js:1 Va @ app.5ad12325.js:1 wn @ app.5ad12325.js:1 zr @ app.5ad12325.js:1 (anonymous) @ app.5ad12325.js:1 Va @ app.5ad12325.js:1 wn @ app.5ad12325.js:1 zr @ app.5ad12325.js:1 (anonymous) @ app.5ad12325.js:1 Va @ app.5ad12325.js:1 wn @ app.5ad12325.js:1 et @ app.5ad12325.js:1 (anonymous) @ app.5ad12325.js:1 r @ app.5ad12325.js:1 await in r (async) n @ app.5ad12325.js:1 Ml.window.addEventListener.capture @ app.5ad12325.js:1 ```Get Started page
F5 on Get Started page
Back to Home once F5 on Get Started page
Validations