Custom tools using multiple root elements in their Vue <template> break other pages #4450
-
Description:I've just spent 4+ hours debugging this weird scenario. If your custom tool's section contains multiple root elements (Vue 3 accepted), rather than just one (old Vue 2 restriction), when trying to click on any other link, the new page will not load. Also, the old scripts from the tool remain in action even after the router view has been cleared, so it seems like the component is not switched properly to the one belonging to the new page. I believe this is an InertiaJS issue, not Nova, but I'm not entirely sure. Detailed steps to reproduce the issue on a fresh Nova installation:
Answer yes to everything.
To confirm that with a single root element is working fine, delete one of the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
I do think this is more of Vue's issue/limitation than anything. |
Beta Was this translation helpful? Give feedback.
-
|
Nova uses Inertia.js internally. I spoke with its creator and this is expected behavior even though Vue 3 supports multiple root elements. Inertia expects to mount a single component and pass it the necessary data. It's recommended to use a single root element for Inertia pages. Any components used from then on will support using multiple ones, but the top-level must be a single element. |
Beta Was this translation helpful? Give feedback.
Nova uses Inertia.js internally. I spoke with its creator and this is expected behavior even though Vue 3 supports multiple root elements. Inertia expects to mount a single component and pass it the necessary data. It's recommended to use a single root element for Inertia pages. Any components used from then on will support using multiple ones, but the top-level must be a single element.