Next.js Discord

Discord Forum

I'm trying to show an overlay when the navigation is delayed too much

Unanswered
martinmunilla posted this in #help-forum
Open in Discord
Avatar
martinmunillaOP
When I use slow 3g or even fast 3g some times navigating takes too long, when this happen I want to be able to show an overlay with some loading feedback.

I know in svelte-kit this could be achieved doing something like this https://www.ratamero.com/blog/showing-a-loading-spinner-when-navigation-is-delayed-in-sveltekit

But I'm not quite sure how to do it in next given that there is no hook or anything giving me information about when navigation is happening

1 Reply

Avatar
Polar bear
It's hacky, but you could add handlers on your navigation components (swipe, button-click, etc) that sets the page to a spinner (I particularly like the Material UI spinner) or somesuch until the next page renders