Replies: 2 comments
-
|
Hi 🙋♂️ I think I am facing the same issue. When inside the function where the routers context gets updated an async operation is made, the route context update occurs later than when without the async operation. A reproduction is possible based on the official authentication example, see here: https://codesandbox.io/p/devbox/nostalgic-cloud-d5s8zx?file=%2Fsrc%2Fauth.tsx%3A7%2C31 (I only added an async operation in the login function and login is not working as before...) Steps to reproduce:
Anyone here to help / explain this in detail? |
Beta Was this translation helpful? Give feedback.
-
|
Did any of you figure this out? I am having a very similar problem and I cannot find a good solution |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
The title pretty much explains the issue. Trying to implement an app with authenticated routes, where auth data is retrieved async.
I came across @Tanner-Scadden's message mentioning that the route should reload on context change, but it is not behaving as explained.
Expected behavior
beforeLoadfunction should be called every time router context changes, and if auth data is not present should redirect to/loginroute.Prepared a simple Vite app to reproduce the problem. Please take a look https://github.com/sher/tanstack-auth/blob/main/src/App.tsx
Beta Was this translation helpful? Give feedback.
All reactions