N
Nuxt3y ago
acidjazz

layout logic failing

<doc-menu v-if="useRoute().name === 'doc-article'">
<slot />
</doc-menu>
<slot v-else />
<doc-menu v-if="useRoute().name === 'doc-article'">
<slot />
</doc-menu>
<slot v-else />
this generates JS errors and fires off the page vue component twice Uncaught DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
3 Replies
manniL
manniL3y ago
Hey! When the layout is rendered, it does not have knowledge about the route yet (on the server). But when the state is serialized, the route is known Thus, the client will render it „as wanted“ but the server doesn’t ~> mismatch
acidjazz
acidjazzOP3y ago
thanks @manniL / TheAlexLichter !
manniL
manniL3y ago
np! 🙂

Did you find this page helpful?