I am currently using next
version 13.4.5 and implementing routing with typescript through /app
.
On my first page, I have a <Link>
(next/link) element that takes me to Page 2. However, when I use the browser back button to return to page 1, the layout breaks. The top section disappears and the page starts from the middle. The CSS styling for the rest of the pages also stops working.
Page 1 is fully server-side rendered (SSR), but in Page 2, I am using "use client";
within the page.tsx
file.
If you would like to see the issue in action, feel free to visit the deployed site:
- The home page can be accessed at home page.
- To go to the login page (page 2), click on this link: login page.
To reproduce the error, visit and click on the "Get Started" button in the top right corner. This will trigger the next/link
tag and take you to the login page. Then, try navigating back using the browser's back button to witness the issue.
As I am uncertain about what might be causing this problem, I prefer not to share any specific code snippets at this time.