Replies: 1 comment
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
beforeLoad
function should be called every time router context changes, and if auth data is not present should redirect to/login
route.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