Link to index page with getServerSideProps and basePath results in full page reload
See original GitHub issueBug report
Describe the bug
Using the experimental basePath
and linking from any page back to the index page with Link
results in a full page reload if the index page uses getServerSideProps
. Looking at the network tab in Chrome I see a request to http://localhost:3000/base/_next/data/development.json
that 404s. In the production build, the request that 404s looks like this http://localhost:3000/base/_next/data/xpCmLw_g1hPw_3b847mWF.json
. I believe there’s a /
missing before .json
.
To Reproduce
- Clone this repo https://github.com/bernardop/next-basepath-repro
- Install dependencies and
yarn dev
- Go to http://localhost:3000/base
- Click on “a” or “b”
- Click on “Back” link
- Index page does a full load and the network tab shows 404 to
.json
Expected behavior
Index page should not fully reload.
System information
- OS: macOS
- All browsers
- Version of Next.js: 9.4.5-canary.8
- Version of Node.js: 14.4.0
Additional context
I believe this was introduced in 9.4.5-canary.8
and I suspect #13876 is the culprit. 9.4.5-canary.7
does not have this error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Data Fetching: getServerSideProps - Next.js
If you export a function called getServerSideProps (Server-Side Rendering) from a page, Next.js will pre-render this page on each request using the data ......
Read more >Is it possible to prevent getServerSideProps causing a full ...
The full page reload happens because the request to retrieve the JSON data for UserDetails page fails during a client-side transition.
Read more >Refreshing Server-Side Props - Next.js - Josh W Comeau
js to re-fetch the data, on demand, without doing a hard refresh of the whole page? In this short tutorial, I'll share the...
Read more >Updating Apollo with Nextjs because of getStaticProps and ...
The example uses getStaticProps in the index.js page, here, but I believe ... with next/link , as a full page refresh will reset...
Read more >getserversideprops not being called - You.com - You.com
Nextjs assumes it to be a component instead of a page, and getServerSideProps () only work inside pages instead of components. Also, getServerSideProps...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing as this is resolved on latest canary, please reply with additional details if you are still encountering problems after upgrading
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.