thepassle / app-tools

125 stars 8 forks source link

Router Refresh Bug (important, breaks history) #23

Closed justinlau12 closed 9 months ago

justinlau12 commented 9 months ago

Hi there, An issue has been noted with the app-tools router, where refreshing (normal and F5) breaks the router navigation of the app. Upon a refresh of a page, after investigating two things happen:

  1. If on Edge, Chrome, Safari: No matter how far you are in the navigation of the app, if you refresh the page, a single back navigation always takes you back to the default browser page, disregarding previously visited pages of the app. It's like the history is gone. However, if you refresh a page. and then navigate to another page, suddenly the history is restored and back navigation works once more.
  2. If on Firefox: No matter how far you are in the navigation of the app, if you refresh the page, the history entry gets duplicated. It takes two back navigations in order to get back to the previous page in the history.

On all browsers, once a page is refreshed the entry is always duplicated, it's just that on Edge, Chrome, Safari back navigation upon a refresh of a page breaks the history which I'm not sure why that is, however like I said above if you then navigate to another page after refreshing one, it restores the history but navigating backwards you will see that the original refreshed page is duplicated and it takes two back navs in order to get to the entry before.

To repro: All I did was create a sample PWA app (under 2 min), taking the steps of installing the PWA package and running the app here: https://docs.pwabuilder.com/#/starter/quick-start

After you start the app, repro the steps above in those browsers specifically, and you will note the problem.

thepassle commented 9 months ago

Thanks for reporting this! I probably wont have time to look into it this weekend, but ill do some debugging next week. If you need a fix sooner im also happy to review a PR if youre willing to make a contribution 🙂

justinlau12 commented 9 months ago

Saw the PR! Thanks for that, check my comment under there

thepassle commented 9 months ago

Should be fixed in #24