router icon indicating copy to clipboard operation
router copied to clipboard

Redirect not showing correct components but will append the correct URL

Open jexodusmercado opened this issue 2 years ago • 6 comments

Describe the bug

I am using the version 1.31.3 in my repository. Redirect is not working properly if I enter the URL directly inside instead of navigating thru UI. Sample authentication repo also has this bug.

Your Example Website or App

https://codesandbox.io/p/devbox/github/tanstack/router/tree/main/examples/react/authenticated-routes?embed=1&file=%2Fsrc%2Froutes%2F_auth.tsx%3A22%2C5&theme=light

Steps to Reproduce the Bug or Issue

  1. enter the /invoice url
  2. no error but will show the invoice components instead of the login

Expected behavior

As a user, I should be redirected to the correct screen. In this case, I am able to view the protected routes even if I am not yet authenticated.

Screenshots or Videos

No response

Platform

  • OS: Linux, Debian
  • Browser: Firefox 115.9.1esr
  • Version: 1.31.3 package version

Additional context

No response

jexodusmercado avatar May 01 '24 02:05 jexodusmercado

Same as #1537.

SeanCassiere avatar May 01 '24 05:05 SeanCassiere

I think this is also the same with #1528. Downgraded to 1.28.1 to make it work for now.

jexodusmercado avatar May 01 '24 09:05 jexodusmercado

Seems like an unfortunate time to checkout the project. I set it up yesterday, file base routing. I have an / index route and a /login route and made it so that the index route always redirects to the login route via beforeLoad and throw redirect(...), just to try things and it just wouldn't work.

upon accessing the / route, the url shows /login but the displayed component is the one from the index route :( Upon reloading (browser url shows /login) it only then shows the component for the /login route.

tmkn avatar May 01 '24 20:05 tmkn

@tmkn Unfortunate indeed as I'm currently fixing this issue!

tannerlinsley avatar May 01 '24 21:05 tannerlinsley

@tannerlinsley all good, I saw you were working on it, updating to 1.31.4 fixed some of the issues like redirecting from /foo to /login.

I like the type safety of the routes and its not urgent to have it working, will most likely stick with it anyway once it's working, I like what I've seen so far :)

tmkn avatar May 01 '24 21:05 tmkn

Tanner has fixed this and it's available in 1.31.5 release.

SeanCassiere avatar May 01 '24 23:05 SeanCassiere