asyncData updates before page transition is done
I am usign the
/server/api
and asyncData
to fetch the data.
Here is an example from my /pages/[slug].vue
:
however, when I am routing, the content is already changing while the page transition is still running. page transition is in out-in
mode though.
Anyone knows why this is happening? (I am on "nuxt": "^3.4.2"
)
Thanks!5 Replies
Try using a unique key.
This won't help. If I add a key I see both contents.
I just did a test with
useLazyAsyncData
which works as I would expect in terms of navigation.What do you mean add? You’re already using a key.
I am not sure what you meant with the unique key; I added
:key="page._id"
at the first div in my template. But this did not help. After adding this key, I was seeing both (old and new) content during the page transition. It is like as if the fetching of new data does not work until the page transition is faded outuseAsyncData(`page${route.params?.slug ?? ''}`, …)