useFetch data is correctly filled but data.value is null?!
Ok, so I have a custom useFetch composable who works perfectly.
I have a useFetch call who correctly display the data in the console:
But if I try to access the
.value
to get any existing property, it returns me null
!
Isn't that weird? I use the same composable in all my app and it's working fine.
How can a ref contains the data but returns null when accessing its value?3 Replies
I've found this reddit thread which exposes the same problem but not the solution 😢 https://www.reddit.com/r/vuejs/comments/10601h3/i_can_get_a_ref_object_but_using_value_returns/
Hmm, it sounds like its due to the fact that the logging happen while the request is still pending.
Not sure why though, the await should lock the current scope execution...
well, depends on what the composable does