vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.29k stars 2.15k forks source link

TypeError: Cannot read properties of null (reading 'parentNode') #4134

Open abu3389 opened 3 months ago

abu3389 commented 3 months ago

Describe the bug

In production when i refresh my page and click my navigation ,get some error :

TypeError: Cannot read properties of null (reading 'parentNode') at remove (framework.DSLrfvyi.js:1:59754) at Object.remove (framework.DSLrfvyi.js:1:52114) at Re (framework.DSLrfvyi.js:1:49058) at vi (framework.DSLrfvyi.js:1:49671) at Re (framework.DSLrfvyi.js:1:48948) at $e (framework.DSLrfvyi.js:1:49908) at Re (framework.DSLrfvyi.js:1:49145) at vi (framework.DSLrfvyi.js:1:49671) at Re (framework.DSLrfvyi.js:1:48948) at vi (framework.DSLrfvyi.js:1:49671)

more click i got new error:

TypeError: Cannot destructure property 'bum' of 'u' as it is null. at vi (framework.DSLrfvyi.js:1:49600) at Re (framework.DSLrfvyi.js:1:48948) at Qt (framework.DSLrfvyi.js:1:47917) at k (framework.DSLrfvyi.js:1:46802) at N (framework.DSLrfvyi.js:1:43756) at P (framework.DSLrfvyi.js:1:42583) at C (framework.DSLrfvyi.js:1:41994) at Ir.x [as fn] (framework.DSLrfvyi.js:1:45706) at Ir.run (framework.DSLrfvyi.js:1:4932) at D.u.update (framework.DSLrfvyi.js:1:46401)

but in develop is still work well? Why?

Reproduction

You can go to my site https://me7.cn/item-ui/components/notify-box/ and click other navigation . the console will get this error

Expected behavior

none

System Info

windows 10
google chrome 127.0.6533.100

Additional context

No response

Validations

mistic100 commented 2 months ago

I have the same problem here https://photo-sphere-viewer.js.org/plugins/video.html (deployed on Netlify)

Two errors are thrown when trying to change page

TypeError: Cannot read properties of undefined (reading '__asyncLoader')

TypeError: Cannot destructure property 'bum' of 'f' as it is null.

The config file : https://github.com/mistic100/Photo-Sphere-Viewer/blob/main/docs/.vitepress/config.mts

mistic100 commented 2 months ago

I reproduce the problem in preview mode. But I am not yet able to pinpoint which configuration is the cause, I created a new project from scratch and it does not exhibit the error.

Here is the full stack trace with minification disabled.

TypeError: Cannot destructure property 'bum' of 'instance' as it is null. at unmountComponent (framework.BLN5K2gG.js:5248:13) at unmount (framework.BLN5K2gG.js:5163:7) at patchKeyedChildren (framework.BLN5K2gG.js:5030:11) at patchChildren (framework.BLN5K2gG.js:4848:11) at patchElement (framework.BLN5K2gG.js:4399:7) at processElement (framework.BLN5K2gG.js:4263:7) at patch (framework.BLN5K2gG.js:4137:11) at ReactiveEffect.componentUpdateFn [as fn] (framework.BLN5K2gG.js:4750:9) at ReactiveEffect.run (framework.BLN5K2gG.js:330:19) at instance.update (framework.BLN5K2gG.js:4785:17)

In unmount method here is the vnode variable, indeed its component is null

Capture d’écran du 2024-09-04 13-22-24

mistic100 commented 2 months ago

So my problem was caused by my custom Markdown container "code-demo" implement with this component https://github.com/mistic100/Photo-Sphere-Viewer/blob/main/docs/.vitepress/plugins/code-demo/CodeDemo.vue

After wrapping the component in <ClientOnly> the navigation works. So I guess for some reason this component have hydration issues... but I am real noob in SSR.