You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Help us to manage our issues by answering the following:
Describe your issue:
I hope it's just me and I missed something in the docs or somewhere else. Was experimenting today with a tag where I do not use any HTML in the tag for templating, but basically create the HTML programmatically (because it's deeply recursive, did seem easier that way) and then injected it via this.root.innerHTML = markup. That all works fine so far, then I tried to unmount the component just for testing, basically just:
onMounted() {
// ... some more code
setTimeout(() => {
this.unmount();
}, 10000);
},
which works perfectly with "regular" components where I use HTML for templating directly in the tag.
but for some reason this component didn't remove it's HTML from the DOM, it does fire onBeforeUnmount() and onUnmounted(), but the rendered HTML simply stays on the page where usually (and expectedly) it is removed from the DOM (and thus the page). I then remembered my raw tag to render HTML content which uses this.root.innerHTML = this.props.html, so I tried unmounting that the same way (setTimeout for 10s) and see, same behavior, triggers lifecycle methods but stays in DOM.
Of course there's a workaround by simply doing:
onUnmounted() {
this.root.innerHTML = '';
}
but I didn't expect having to do that?
So the question is: Is it me doing something wrong here or is this a bug?
I don't know how it's possible that it went unnoticed for so long
Me neither 🤣 , but probably bc it's mostly used with this raw trick to render HTML which is usually some kind of child component which gets properly unmounted when the 'regular'/parent component gets unmounted.
Help us to manage our issues by answering the following:
I hope it's just me and I missed something in the docs or somewhere else. Was experimenting today with a tag where I do not use any HTML in the tag for templating, but basically create the HTML programmatically (because it's deeply recursive, did seem easier that way) and then injected it via
this.root.innerHTML = markup
. That all works fine so far, then I tried to unmount the component just for testing, basically just:which works perfectly with "regular" components where I use HTML for templating directly in the tag.
but for some reason this component didn't remove it's HTML from the DOM, it does fire
onBeforeUnmount()
andonUnmounted()
, but the rendered HTML simply stays on the page where usually (and expectedly) it is removed from the DOM (and thus the page). I then remembered myraw
tag to render HTML content which usesthis.root.innerHTML = this.props.html
, so I tried unmounting that the same way (setTimeout for 10s) and see, same behavior, triggers lifecycle methods but stays in DOM.Of course there's a workaround by simply doing:
but I didn't expect having to do that?
So the question is: Is it me doing something wrong here or is this a bug?
https://plnkr.co/edit/qp3fJhYjxtcptRFc
MacOS / Chrome
9.0.3
The text was updated successfully, but these errors were encountered: