You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to browse to /test via a nuxt-link, it seems that the page rendering doesn't wait for asyncData. Then when refreshing the /test page, it works correctly.
Additional context
No response
Logs
[Vue warn]: Invalid prop: type check failed for prop "simplePost". Expected Object, got Null
The text was updated successfully, but these errors were encountered:
That's correct and expected. You can use await useAsyncData to ensure it will wait or handle the null case separately (which is preferred, e.g. via v-if)
OMG, totally missed that (wasn't expecting to use await without an async)
@manniL if you could make that clarification stand out in the docs, I guess it would save lot of time for the next one that falls into this. Thanks for the quick reply!
Environment
Darwin
v20.13.1
3.11.2
3.11.1
2.9.6
npm@10.5.2
-
components
-
-
Reproduction
Clone this repo and
npm run dev
or check this codesandboxGo to index page and click link (video)
Describe the bug
I have an endpoint in the
/server/api
folder that sends thisJSON
as a response.I have a
TestCard
component that receives an object as a prop:In my
/test
page, I fetch this data withasyncData
andfetch
as recommended in the docs, and then I send that object as a prop:When trying to browse to
/test
via anuxt-link
, it seems that the page rendering doesn't wait forasyncData
. Then when refreshing the/test
page, it works correctly.Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: