T
TanStack17mo ago
like-gold

redirecting in beforeLoader changes url but not the mounted component

hey all i had a quick question regarding the redirect feature
export const Route = createFileRoute("/auth/instagram")({
validateSearch: (search: Record<string, unknown>): ItemFilters => {
return {
code: search.code as string,
};
},
component: InstagramAuth,
beforeLoad: async () => {
console.log(auth.currentUser);
if (!auth.currentUser) {
console.log("should redirect");
throw redirect({
to: "/",
});
}
},
});
export const Route = createFileRoute("/auth/instagram")({
validateSearch: (search: Record<string, unknown>): ItemFilters => {
return {
code: search.code as string,
};
},
component: InstagramAuth,
beforeLoad: async () => {
console.log(auth.currentUser);
if (!auth.currentUser) {
console.log("should redirect");
throw redirect({
to: "/",
});
}
},
});
I have this route, if i try to redirect from the component in the beforeLoad it will change the url but the components wont change properly and plus there is also no errors being thrown either here the url is / but the components is still /auth/instagram This is my first post so sorry if this is not the right formatting please let me know, happy to take it down
4 Replies
like-gold
like-gold17mo ago
This is actually a bug that are facing right now. If you install a version prior to 1.28.2 you should be fine.
like-gold
like-gold17mo ago
GitHub
redirects thrown in the __root beforeLoad aren't showing the correc...
Describe the bug I am facing an issue on admin panel I am developing now. Sometimes, I cannot find exact steps to reproduce it just returns nothing in Outlet. I checked all my code tree and there i...
like-gold
like-gold17mo ago
This has been fixed now.
like-gold
like-goldOP17mo ago
Thank you

Did you find this page helpful?