visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

Page reload on redirect page("./pageToRedirect") #576

Open micabal opened 3 years ago

micabal commented 3 years ago

Would it be possible to parse the path and remove the leading dot in the url if any ? Indeed, having a leading dot cause the page to reload. I have seen some people having the same issue.

page("./pageToRedirect") redirects with a page reload.

page("/pageToRedirect") works as expected

https://github.com/visionmedia/page.js/blob/4f9991658f9b9e3de9b6059bade93693af24d6bd/page.js#L1005

micabal commented 1 year ago

In fact I realized that the unexpected behavior may be expected sometimes.

page("./pageToRedirect") redirects with a page reload => should be kept!

For example, when "login out" a user, it may be required to reload all resources. In my case, page.redirect("./") was perfect because it did not keep the "/logout" page in history and still reloaded resources.

The leading dot behavior should be kept but detailed in the documentation.