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
7.27k stars 495 forks source link

Router.status is always "pending" when you wrap the `RouterProvider` in `StrictMode`. #1566

Closed ThijsTyZ closed 3 weeks ago

ThijsTyZ commented 3 weeks ago

Describe the bug

If the RouterProvider is wrapped in <React.StrictMode>, the status of the Router is alway "pending".

Due to this issue, you can never get the correct resolvedLocation, because this will always return the first location you visited.

Your Example Website or App

https://github.com/TanStack/router/blob/main/examples/react/basic-file-based/

Steps to Reproduce the Bug or Issue

Change line 23 of examples/react/basic-file-based/src/main.tsx to:

root.render(<React.StrictMode><RouterProvider router={router} /></React.StrictMode>)

And run the app normally. Noticed in the TanStackRouterDevtools that the status of the Router is always "pending" and the resolvedLocation is never changed when navigating in the app.

Expected behavior

As a user I would expect that the status if the router is "idle" after navigation and resolvedLocation returns the current location

Screenshots or Videos

No response

Platform

Additional context

No response

SeanCassiere commented 3 weeks ago

This has been completed as of the 1.31.26 release.