jeffreyguenther / vue-turbolinks

A Vue mixin to fix Turbolinks caching
MIT License
287 stars 20 forks source link

Issue with components that need to access $el.parentNode after component destruction #28

Closed alexisagos closed 4 years ago

alexisagos commented 5 years ago

Hi,

First of all, thanks for the great mixin !

I have come across an error caused by the adapter when using a vue component library (Element UI). The Message component that displays a message at the top of the page that then disappears is causing a bug because at one point it needs to access the component's $el.parentNode after having destroyed it but because of the vue-turbolinks adapter, the element's outerHTML has been modified and parentNode is null.

Cannot read property 'removeChild' of null

I have reproduced this issue here: https://codesandbox.io/s/j4k708vzy5

Is there a way to prevent this issue from happening at the adapter level ?

excid3 commented 5 years ago

Hmm, probably. I'm not sure how Element inserts the item onto the page. May have to dig into Element's Message component and see how it handles things.