I'm currently using Next.js 13.1 with the pages directory (not using React Server components yet). In my application, when I use router.push()
to navigate from page A to page B, I've noticed that the router waits for the getServerSideProps()
of the page B to complete before performing the navigation.
This brings me to two questions:
- Is this behaviour expected? I couldn't find any information on the official Next.js documentation indicating that
router.push()
is a blocking operation - If this behaviour is expected, should we handle page transitions only at a global level, as mentioned here in the documentation? If the router performed the client-side navigation immediately, handling the loading would be delegated to the destination page and we could implement specific loading UIs for each page (e.g. different skeletons for different pages)