Closed eric-hemasystems closed 5 years ago
Hey @eric-hemasystems, thanks for the PR!
Any way you could make a jsfiddle or something to showcase the error this fixes? I haven't seen an issue with this before, so it'd be good to see / learn about what cause this would fix.
Sure thing. Take a look at the console section of:
https://codesandbox.io/s/71zp9kw910?expanddevtools=1&moduleview=1
You can see an error is caused by the turbolinks adapter. If you comment out the use of the adapter the error goes away. Alternatively a dummy element can be passed to $mount
as a workaround so that the adapter can still be used.
Thanks! This makes sense.
If you're not rendering the Vue app to the page, what's the point in using the Turbolinks Adapter?
In general I am doing these the conventional way. I just have a specific scenario where I need to render a component off-document. When I attempted to do this (while the Turbolinks adapter is configured globally for all the conventional code) I got that error. Giving a dummy off-document element is an ok work-around but it shouldn't be necessary. The Vue documentation specifically gives examples where you can render Vue components off-document.
Gotcha. That makes sense I guess. Was trying to wrap my head around the use case. 👍
In #17 this guard was put on the
destroyed
callback but I believe it also needs to be applied to thebeforeMount
callback. Vue allows$mount
to be called without an argument to render off-document. See:https://v1.vuejs.org/api/#vm-mount
This avoids an error when a component is rendered off-document.