vuejs / router

🚦 The official router for Vue.js
https://router.vuejs.org/
MIT License
3.77k stars 1.16k forks source link

Infinite loop #2297

Closed oswaldofreitas closed 2 weeks ago

oswaldofreitas commented 2 weeks ago

Reproduction

https://play.vuejs.org/#eNqVVW1v2zYQ/is3dYBlzBGTLOgHz8nSBcG6YmuLNtiXeUBpibJYS6RAUo4Dw/99dyQl20karEACS+S9PM/dc6dt0nCpsq82mSayabVxsIXcCO7Em7aFHZRGNzBad2I0V9HA6M4JE28yFl731+TX3/G2zYLvXA1RU/wfzxVA1lmRBvfw3uhOuXT0Ct1G42SSRHfENnOiaWv0vyLDWet/8ME6o9Xy6qYzRqgIDVruqumMxTvYbuFHf5GVXV1/xEvY7XwYFuLMFF/3AT95OH9KtQKnL+cJmydXb3UjZmx/801bvsAT5oR16PWGXp5zk/EB4K6SFmryR/DCWJAK/0qpJLKotW5hIXKOVQJdgquImbWiwB/DG+CqQKOlzMktlBEbGZOwkGXGem4zavQx8r+luAcW7eL1DOHHSmMDhqhP5fGXaLR5eCutw59JPAxxD2VzMshjEAiVc1AIvUSJ9Pqhug33/m2vIa1s7LKFS/iHoG9Dv2HERghDYxCF1ZyGNLvJsUno0NQX8OzXY4eQmDz+fZTLYK5DgumWomLziPv0uYKkY584IMXHHQp8rmI5F6LURtzyvEpTpyee6wSU2LgxXKJeyZOy61pk2OB0tHdAxE4POh4DY3COMpAkH547qVWQCuqq0noFttJdXUDF18IL6Etg/gUMol2LYgIL5CwdFFpYNXKEEkCWkP6AebyxDT9n4wAMSQnXGeXxpuNf6Aynqcfs8PzeVwlr9u7zh/fkjWPuH3EipVrK8gFpj8mVvApRC7Tu3Y6TRhufawtZlvVmE4SBMs3FFJzpsNEULlRZbLyOClHyru47iGLupfZ0nVTnccbxwR9gURyW8jqvZb7CyV7qO+3lgXP9u8YWBLHMWDAMTv1c35AT8gxtiKHutVlZ4DjibmRBaednmay4eggDbSkuNckjDlNJMQ9GkujNbG5k68BiG2h/DXOJe+Ll+Xuk6ME+9WUrOxUENJBNY8ujbNvOVmkcoRG6YNdxyXowtCuGSX22vrFefYFbI65wL4e1HNnvdriQ8fz7Gf8Pwgd8ie4h8BDupOEtLjqtEL5nPY8Xdp5Me+nPk30GOp4nlXOtnTLWqXa1zHCbsL3F9UV2wQpcCAdnmbDNycLoexu2deL3BEW+RiNWiLXTurYnvJXfSvDE8Pp19jo7Y7VcMIzOpCrExseOs7lDks5iMUq5fESR1p+shfnQUuuPqfK61vfv/BmN2AA0r0S+eub8q90EyB+NQHZrcUDOcbMUOD10ffv5PY7zwWWji65G6xcuPwnchh1hDGa/dapA2Ad2Hu0fvmM4VXf2duOEsj0pAuqr4e19G29eoL6H+3N2cVBF6x5qYbPc0gcRv6wToM9m8FtoUwgzhfN2AwhWFvDq9PTU78cGw0l1stC4CpopnJ22G3/e8qJAsMOJ36MYFq6Aw0/47wNH71qU+JHqLZPdfwehU8w=

Steps to reproduce the bug

  1. Click on Go to About button
  2. It shows the About view (works)
  3. Go back to Home
  4. Click on About nav link (doesn't work)

Expected behavior

I expected that when clicking on About link it should show the About view

Actual behavior

Since there is a param1 passed to the route from the About link, when it enters in the beforeEach hook in router.js it tries to remove the param in a newRoute object and pass to the next() with replace: true, however next when it enters again in the hook I see that the param was not removed as I understand it should.

Additional information

I had a similar code in my app that always worked, but I noticed that the issue started to happen on 4.3.0, however in the playground I can't make it work even in earlier versions.