-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read properties of null (reading 'insertBefore') #5657
Comments
related #5650 the error message is not same in chrome and firefox: |
the error of slot function execution affects block tracking,as a workaround,add |
@javastation When remove the outer div, the error seems gone sfc playground , so add a try catch maybe not a good fix. |
Although there is no visual error in this example, it will enter full diff mode. If there are some other static html elements in addition to these three dynamic children, it will cause unnecessary performance consumption. |
Not sure if try-catching the rendering of a slot is something that is supposed to be possible |
@javastation I don't understand why add a outer div will cause this error. |
flowchart TB
subgraph A[showTable change]
direction LR
2(patch root vnode)-->3(root.el=preRoot.el):::red-->4(dynamicChildren!=null)-->|true|5(patch dynamicChildren,mount table using oldEl.parentNode)-->6(end:secondDiv.el is null):::red
end
subgraph B[checkbox change]
direction LR
12(patch root vnode)-->13(root.el=preRoot.el):::red-->14(dynamicChildren!=null)-->|false|15(full diff)-->16(diff second div,second.el = preSecond.el):::red-->17(now secondDiv.el:null)
end
A-->B
classDef red fill:#faa;
The value of the second div |
hi ,i use error will show in |
This problem always occurs in pages that use keep-alive. |
Could you provide a minimal repro? |
No,doesn't always appear, and only appears in production environment. |
If you remove the m-table component first, then restore it, it will not give an error. |
Hello! Thank you for your work. Our team has encountered a similar error in production and we have no ideas how to fix it from our side. |
hey! got the same thing here: For us, this was triggered when Firefox is auto-filling some inputs, but I don't think it's relevant. The important thing is that it's only happening in prod mode... After digging a little bit, it looks like the We've actually lost some mental sake points trying to debug this! |
Hi everyone. I also have this issue only in prod mode. A temporary workaround: remove a |
In my case, I don't have any |
Hi. I also have this issue only in prod mode. |
The render function is also a workaround, like above reproduction:sfc.vuejs.org |
I also had this issue only in prod mode. Before
After
|
I encounter this issue too. It only happens on SSR and production build. Some conditions are required to produce the bug:
|
If anyone is still dealing with this. We worked around the error by replacing most of our |
Nice 😄 😄 😄 |
I'm also facing this issue using the nuxt-rc6. Real pain. |
@HarisSpahija it dosn't work in my projects. 我给了我项目里的所有点式操作加上了可选操作符,然后解决了这个问题。 <template #roles="scope">
<template v-if="scope.row.roles?.length">
<el-tag v-for="(item, index) in scope.row.roles" :key="item" size="small">
{{ item }}
</el-tag>
</template>
</template>
<template #status="scope">
<el-switch :disabled="scope.row.roles?.includes('super-admin')"></el-switch>
</template> 虽然暂时解决了问题,但是在开发者工具上面的错误提示,让人费解,无法定位问题所在。
像这样子的报错,让我十分困惑,很难定位问题所在。 |
Thank you for your information! |
i already do like this by adding ?. in the scope ,but didn't work, any other ideas? thanks all |
I also had this issue only in prod mode at [email protected], and I fix by abstracted into components before
after
|
The slot fix in 3.2.41 did not help in our case. Turns out it was the use of a dynamic component to implement layout switching in our top level
Since
I've tried creating a stripped down repro but so far unsuccessful. Hopefully this will help someone resolve this issue if they hit it again in the future. |
I'm using nuxt3, this error occurs when I use component |
I also face this issue but I have no idea how to fix it nor do I know where exactly the issue occurs. Sometimes when changing from one tab to another via URL param the error occurs. Is there any plan to fix it entirely? |
…ot affect block tracking (vuejs#5670) fix vuejs#5657
Will this ever be fixed? I love Vue, but this is a very annoying problem I run into with every Vue project.
In this code, when aiModelSetting becomes AiModelSettings.Fixed when I press the corresponding VaOption, the error happens and Vue breaks (requires a refresh). I removed the options in the VaSelect to verify it didnt have anything to do with them. |
@soylomass No I don't think it's fixed. I made a new thread here: #7921, the error is slightly different depending on how it is triggered but I think it's the same underlying issue causing a "Cannot read properties of null" in HMR If it doesn't get fixed soon I'll have to copy all UI components into the project instead of using libraries because it's such a PITA to debug atm |
…ot affect block tracking (vuejs#5670) fix vuejs#5657
I'm also experiencing a similar issue with PrimeVue. I replaced some unnecessary tags with tags and I'm wondering if that could be related to the issue
Edit In my case, I've a structure like this :
It seems, although not yet clear, that when I replace the root tag, which contains a v-if directive, with a tag, and then make changes in my CustomComponent, it triggers the bug. I hope this information is not misleading. |
- would get locked if space, enter, or click during expand or collapse - v-if to v-show based on: vuejs/core#5657
also faced this problem on nuxt 3.3.1
i changed it to:
and my variant with useAsyncData broke everything :) |
should this error due to the massive unresolved issues be opened again? Opened again? |
This helped a lot, in my case, removing a v-if from the top level of a template resolved the bug. Now, the v-if directive is applied to a direct child: <template>
<div v-if="xxxx">
<div>With Content</div>
</div>
</template Now: <template>
<div>
<div v-if="xxxx">With Content</div>
</div>
</template |
It turns out in my case the component that was causing this bug was wrapped in a Before: <template>
<transition name="fade">
<div>
// .. other divs
</div>
</transition>
</template After: <template>
<div>
// .. other divs
</div>
</template |
There's a bug that appears when building for production if Transition wraps an element without a `v-if`. vuejs/core#5657
Same issue in nuxt 3.6.5 and vue 3.3.4. |
- would get locked if space, enter, or click during expand or collapse - v-if to v-show based on: vuejs/core#5657
why is this one not open???? |
Because the devs want a reproduction example, something impossible to get because of the random nature of this bug, sadly. If only the error message could be a little bit more descriptive. |
even more important it is to take out the random nature and work on finding a reason from the devs/contributors |
Version
3.2.31
Reproduction link
sfc.vuejs.org/
Steps to reproduce
click the checkbox
What is expected?
everything is fine
What is actually happening?
TypeError: Cannot read properties of null (reading 'insertBefore')
Only reproduced in production environments
The text was updated successfully, but these errors were encountered: