Next.js Discord

Discord Forum

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

martinmunilla posted this in #help-forum
Open in Discord
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

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

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