Closed xiaodid closed 2 years ago
I had the same issue. I changed https://github.com/preactjs/preact-router/blob/master/src/index.js#L188 from:
this$1.routeTo(("" + (location.pathname || '') + (location.search || '')));
to:
this$1.routeTo(("" + (location.location.pathname || '') + (location.location.search || '')));
This might break other things but works for me.
Same issue here...
Browser back+forth doesn't work with hash history using history@5.0.0
with preact@10.5.7
and preact-router@3.2.1
.
It works fine with history@4.10.1
... 🤷♂️
can confirm that using history@4.10.1
fixes it for me
what happed
1, create a default project by using preact-cli. 2, then following the preact-router document to add
createHashHistory
3, then build the project, but a error will occur, just like mentioned below:377
4, after adding those build parameters
--no-sw --no-ssr --no-esm --no-inline-css --no-prerender
, the build can be done. 5, then runnpm run serve
to start dev server 6, open localhost:8080, then click Me, then click John 7, click the back button of browser several times. 8, the wrong page will be seen.preact-router@3.2.1 history@5.0.0 preact@10.4.8 preact-cli@3.0.1