Open userquin opened 1 year ago
I guess, a simple fix for vue
will be to return undefined
in the watchEffect
when deactivated, and do not patch
the entry if undefined
in the watcher
: https://github.com/unjs/unhead/blob/main/packages/vue/src/runtime/composables/util/clientUseHead.ts#L13
There is no way to build unhead
on Windows using Node 16.17, dom package error:
Hey @LittleSound
Would you have any ideas on this? Happy to investigate otherwise
I have a similar problem, but on the client side. I use a mixin to utilize the head
component option (i'm migrating from vue 2 to vue 3) and when the route changes, the head
option is called with the new route instead of the old one, which breaks the page because of the incorrect route params. So the component option is called on the route, where the component is not ment to render, which is unexpected.
It seems like this problem is caused by watchEffect
in useClientHead
running with the default { flush: 'pre' }
option, which makes it to process the input
when the route has been changed already, but the component itself is yet to be unmounted/deactivated. Using { flush: 'post' }
for that watchEffect
fixes it, running after the component has been changed - which at least on client side should be ok, I suppose.
I'm still digging into this to understand why flush
option matters this much and maybe there is some other solution, but maybe someone here cane make use of this info. Currently I patched it in my own code, but I'll try toi come back if I find that my solution is the right one (or if i'm wrong and this need to be scraped).
UPD: it works fine when using useHead
in setup
, the issue is only with the mixin calling useHead
in created()
.
Environment
Nuxt 3.3.2, Node 16.17.0 (on my local), can use Node 18: check package on Elk repo https://github.com/elk-zone/elk
Reproduction
check https://github.com/elk-zone/elk/issues/1776, we can use https://elk.main, requires mastodon account, check video on
Additional context
.Describe the bug
There is no way to correlate head data and current route: when we use keep alive, all headers configured on any page that has been activated will be there.
It seems we've a race condition with deactivated and activated page hooks, check snippet code on
Additional context
below.Additional context
You can check it in this video: https://streamable.com/e1jmkr
Using this code on
plugins/hydration.client.ts
, active header entries grows and grows on each transition:Logs
No response