This repo is a minimal testcase of a issue related to serversiderprops in nextjs.
There are 2 monorepos in this repo - nextjs/ and blog/. Their deployment is configured using now.json
- which is the old way of confguring vercel project. Internally now.json uses the routes
key to configure the redirections.
This is regarding the point here -> https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props#when-does-getserversideprops-run
When you request this page on client-side page transitions through next/link or next/router, Next.js sends an API request to the server, which runs getServerSideProps getServerSideProps returns JSON which will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have getServerSideProps defined.
On this website, when you click on "Goto a level page" link, the JSON request that goes is resulting in 404. And therefore, the whole page is fetched and complete reload happens.
Steps to reproduce:
- Goto homepage
- Open devtools
- Click on "Goto a level page"
- Instead of client side redirection, complete page reloads
- Check in devtools, the JSON request for serverside props is 404