This project demonstrates an issue with browser back navigation when using dynamic routing in Next.js.
- Click the button below to navigate to Dog 1.
- Every 3 seconds, the page automatically shows the next dog.
- If you use the provided button (Link), the browser's back button will sometimes work and sometimes not.
- If you manually navigate to any dog slug (e.g.,
/dog/1
,/dog/2
, or/dog/3
) and let the page cycle through the dogs automatically, pressing the back button results in a blank new tab page instead of returning to the previous page.
- Expected: Pressing the back button should return to the previous dog page.
- Actual: After navigation using
router.push
, the back button sometimes leads to a blank tab instead of the previous page.
- Install dependencies:
yarn
- Build the project:
yarn build
- Serve the static files:
Alternatively, you can run the project in development mode:
npx serve@latest out
yarn dev