zilch / type-route

The flexible, type safe routing library.
https://type-route.zilch.dev
MIT License
426 stars 15 forks source link

Can't go back, after first push action in codesandbox #32

Open seivan opened 4 years ago

seivan commented 4 years ago

First of thank you for such an amazing library. It has a neat and tidy public interface, it's nice to see a routing lib implemented so well in Typescript. Really happy over how small the API surface is.

There seems to be a bug where you can't go "back" after selecting a route the first time. I think when the previous "action" was an "initial", the back button remains disabled.

It works after you click on a second route, but the first routing action should allow you to go back.

Sandbox

bradenhs commented 4 years ago

Thanks for the bug report! I took a look and was able to reproduce. I'll give this a closer look tomorrow.

bradenhs commented 4 years ago

I was only able to reproduce this in codesandbox, not 100% why yet. Did you run into this anywhere else?

seivan commented 4 years ago

No, I was evaluating it using sandbox, but I guess that's not fair. I'll close this for now, but I suspect you're right and it's isolated to there.

Could be related to HRM.

bradenhs commented 4 years ago

I'm going to reopen this and update the title to make it specific to codesandbox since it'd be nice if that worked. Might not be able to do anything from this end but I'd still like to look into it more.

garronej commented 4 years ago

Hi @bradenhs not sure if it is the same issue of something not related at all but I would expect to be able to navigate back. Currently this is what I am having:

Screen record

bradenhs commented 4 years ago

Thanks for sharing the screen recording @garronej! If I'm understanding correctly there could be an issue here depending on what the route was before the screen recording started.

We start at /funcamp and then replace /funcamp with /funcamp/home and then the back button is clicked. Since replace was used and not push its as if the initial /funcamp route was never in the browser's history at all. The /funcamp/home route now has taken its place. So when the back button is clicked we are going to go back to what was before the initial /funcamp route. If that happened to be /funcamp/home then the behavior we're seeing here would seem to be correct. Could you do a little more investigation on your end to verify if that's the case or not? I'd love to get to the bottom of this if there is a problem here.

garronej commented 4 years ago

@bradenhs you're right of course there is nothing wrong with the lib. RTFM for me. :octocat:

Thank you for the explanation. I am talking a lot about your lib around me btw.

Cheer