Next.js Discord

Discord Forum

Display loading.tsx as soon as router.push is called

Unanswered
West African Lion posted this in #help-forum
Open in Discord
West African LionOP
Is there a way to force the loading.tsx component to display as soon as router.push has been called?
I have noticed there is a delay, such as when a user submits a form resulting in router.push, before the loading component appears.

5 Replies

European sprat
Have you tested production build? Dev mode can be slow for things to show up but it may work fine in production
@European sprat Have you tested production build? Dev mode can be slow for things to show up but it may work fine in production
West African LionOP
Seems to be the same situation in production builds too. I'm wondering if loading will only display once it has actually started loading the new page after the url has been pushed and the delay between pushing and starting to load might be longer than expected.
Blanc de Hotot
@Blanc de Hotot https://caspertheghost.me/blog/nprogress-next-js Try nprogress
European sprat
This doesn't work with app directory and isn't really relevant to loading.tsx