This is a minimal reproduction created by "npx create-next-app@latest --typescript"
Question: How to prevent the router.push() from remembering the route to which it was redirected
To reproduce:
- Go to '/' repeatedly. You have a 50% chance of being redirected to '/dashboard' and 50% to '/profile' because of middleware.ts
- Go to '/login' and click on Login. This will make a router.push('') and be redirected either to '/dashboard' or to '/profile'.
- Click on logout to return to '/login'.
- The next times Login will always redirect to the same route.