-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<NuxtLoadingIndicator>
and loading events
#14221
Comments
curious - are we going to have any methodology/documentation to hooking this into |
I'd like to share a hack I've been using just to see if it's useful: I have an Api lib/class I use to interact with my API that wraps around ohmyfetch - and from it i set fetchOptions to fire off my own start/finish cal hooks: fetchOptions.onRequest = () => this.nuxtApp.callHook('page:start')
fetchOptions.onResponse = () => this.nuxtApp.callHook('page:finish') I get multiple loading indicators for each call if its multiple unlike v2 which would combine them - but it works! demonstrated in my laravel+nuxtjs template https://github.com/fumeapp/laranuxt |
It works! Thank you ! |
See #16351 for other options, as calling hooks could have other side effects. |
Hi, |
@mrleblanc101 A PR is absolutely welcome! As this is already possible in userland (see answer in #16351), the priority is set to "nice-to-have" |
Preferably a way to do this so that multiple fetch calls balance out to one single load bar - how nuxt2 worked. |
@manniL I don't understand your workaround. You say callHook can have dangerous side effect
You link to another issue where you also mention to use callHook without saying what are the side effect or an alternative without side effects 🤔
What is the solution in user land without side effect ? |
@mrleblanc101 I think he means that current solution for now w/ the potential side effect which lowers the priority of this feature |
I meant specifically an own implementation approach as @Gaspadlo did #16351 (comment) for now. Sorry if that was unclear. |
When
<NuxtLoadingIndicator>
landed, we should introduce a controller API (TODO: issue pending in framework). This should address a long time waiting for a feature for Nuxt 2 (#7893, nuxt-community/axios-module#247 (comment)) in a consistent way with Nuxt 3.The text was updated successfully, but these errors were encountered: