TanStack / router

🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering.
https://tanstack.com/router
MIT License
8.32k stars 668 forks source link

Infinite recursion loop (Router.routeMatches<->controlledPromise.resolve) #2871

Open ondrejvelisek opened 3 days ago

ondrejvelisek commented 3 days ago

Which project does this relate to?

Start

Describe the bug

Hi,

another day another bug report from me.

When I access a route with redirect in beforeLoad JS ends up in infinite recursion loop (see attached perf devtool flamechart)

Related code is here: https://github.com/ondrejvelisek/peoples-budget/tree/infinite-loop-bug/app/pages/~2024

I hope I'm helpful.

Your Example Website or App

https://peoples-budget-git-infinite-loop-bug-ondrejveliseks-projects.vercel.app

Steps to Reproduce the Bug or Issue

  1. go to https://peoples-budget-git-infinite-loop-bug-ondrejveliseks-projects.vercel.app
  2. click second menu link "Vládní rozpočet 2024"
  3. freeze

Expected behavior

It correctly redirects without freezing a browser.

Screenshots or Videos

Image

Platform

Additional context

Happens on both production and dev server builds. Better to debug with Firefox. Safari devtools freezes together with page.

schiller-manuel commented 3 days ago

it would be very helpful if the reproducer could be trimmed down so we know what's going on here (e.g. does it only happen with splat routes?). can you please use one of the existing router example on stackblitz and modify it so it fails as well?

also you tagged this as start, but this is probably a router issue. so we need to narrow this down.

ondrejvelisek commented 3 days ago

Currently I have no idea what it causes. So I need some time to investigate this. Hopefully within 2 weeks. Its just a hobby project.

If you will have time sooner, feel free to investigate on your own. So we know sooner. In that case please write here so I know I dont need to spend time on it. Thx.

On Wed 27. 11. 2024 at 0:38, Manuel Schiller @.***> wrote:

it would be very helpful if the reproducer could be trimmed down so we know what's going on here (e.g. does it only happen with splat routes?). can you please use one of the existing router example on stackblitz and modify it so it fails as well?

— Reply to this email directly, view it on GitHub https://github.com/TanStack/router/issues/2871#issuecomment-2502190436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB36VJFXRA4UNHUJCCYTPFD2CUA6LAVCNFSM6AAAAABSRJWCXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBSGE4TANBTGY . You are receiving this because you authored the thread.Message ID: @.***>