-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Description
Describe the feature
Hello,
As discussed in #24900.
There should be an option for useLoadingIndicator.start({ force: true })
so when it's called the Loading indicator should start from scratch.
Currently, after the page load it's not possible to manually start useLoadingIndicator
because there is setTimeout
which is basically preventing the start:
nuxt/packages/nuxt/src/app/composables/loading-indicator.ts
Lines 16 to 23 in f5676fb
function _hide (isLoading: Ref<boolean>, progress: Ref<number>) { | |
if (import.meta.client) { | |
setTimeout(() => { | |
isLoading.value = false | |
setTimeout(() => { progress.value = 0 }, 400) | |
}, 500) | |
} | |
} |
As suggested by @manniL I could use a workaround and wait 1 second
export default defineNuxtPlugin({
// eslint-disable-next-line unused-imports/no-unused-vars
async setup(nuxtApp) {},
hooks: {
// You can directly register Nuxt app runtime hooks here
'page:loading:end': async function () {
console.log('Calling startLoading function from a plugin!');
await new Promise(r => setTimeout(r, 1000))
startLoading();
},
},
});
Honestly, this makes loading indicator as lagging which is weird.
Thanks!
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.
Metadata
Metadata
Assignees
Type
Projects
Status
Later