-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 property 'type' of null at unmountComponent #1745
Comments
I tracked for this and the blew is a mini-reproduction.Maybe we should internal provider a safer getter for <script src="./dist/vue.global.js"></script>
<div id="app"></div>
<script>
const {createApp, computed, setBlockTracking} = Vue
// this can fix this.
function saferGetter(getter) {
return () => {
setBlockTracking(-1)
const res = getter()
setBlockTracking(1)
return res
}
}
const Parent = {
template: `
<section class="c-container" :class="{ 'is-vertical': isVertical }">
<slot/>
</section>
`, setup(props, {slots}) {
const isVertical = computed(saferGetter(() => {
// this caused the bug because `computed` getter run inside `render` and collect this into dynamicChildren.
return !!slots.default()
}))
return {
isVertical
}
}
}
const Child = {
template: `<div>child</div>`,
}
const app = createApp({
components: {
Parent, Child
}, template: `
<Parent>
<Child></Child>
</Parent>`
})
app.mount('#app')
setTimeout(() => {
app.unmount('#app')
}, 3000)
</script> |
‘saferGetter’ is ok, but muset use this? |
Hmm, Also, if you are trying to check for presence of a slot, you should do |
I have this error. |
Version
3.0.0-rc.5
Reproduction link
https://github.com/PingTouG/layer
Steps to reproduce
leave "/componnets/container" router
What is expected?
to other router
What is actually happening?
TypeError: Cannot read property 'type' of null at unmountComponent
The text was updated successfully, but these errors were encountered: