Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

help: useAsync useFetch loading #329

Closed
ralatas opened this issue Dec 18, 2020 · 3 comments
Closed

help: useAsync useFetch loading #329

ralatas opened this issue Dec 18, 2020 · 3 comments
Assignees

Comments

@ralatas
Copy link

ralatas commented Dec 18, 2020

馃摎 What are you trying to do? Please describe.
I try get Promice in my page using useAsync or useFetch. When i use asyncData in client side - nuxt do default loding (progress line in top part), and after data will be loaded, nuxt do redirect in target page. When i use use useAsync or useFetch. nuxt make redirect in target page and affer start useAsync hook. How using useAsync give loading how
use asyncData ? Sorry for my English

馃攳 What have you tried?
image

鈩癸笍 Additional context
https://nuxtjs.org/docs/2.x/features/loading

@mathe42
Copy link
Collaborator

mathe42 commented Dec 18, 2020

When the page is loaded and a navigation happens with the normal asyncData nuxt will hold until the data is loaded. With the composition-API this can't be done with the current Nuxt APIs. I wrote useAsync with the intention to get as close as we can near the behavior of asyncData but when setup is called the navigation already happend.

With Nuxt 3 it is posible to do this but not with Nuxt 2 馃憥

Hope that helps

@ralatas
Copy link
Author

ralatas commented Dec 18, 2020

Thanks for the answer

@Ovyerus
Copy link

Ovyerus commented Mar 22, 2021

With the composition-API this can't be done with the current Nuxt APIs.

Been having an issue in my SPA with this, been needing to handle the null refs before they resolve, and wondered why this didn't happen before. Is there anyway to possibly use the old asyncData alongside the composition API to get the blocking behaviour, or would I need to go back to using the regular options API in order to do so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants