visionmedia / page.js

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

Issue: appending multiple query param to url #412

Closed longS2baobao closed 6 years ago

longS2baobao commented 7 years ago

page.js line 167. var url = (hashbang && ~location.hash.indexOf('#!')) ? location.hash.substr(2) + location.search : location.pathname + location.search + location.hash;

I'm having problem with the above highlighted part. It keeps pending query string to the end of my url. I'm not sure if this is a bug.

Input: https://localhost:8551/?s=1

Processing code: const defaultRoute = 'MYPAGE' page('/', () => { page.redirect(defaultRoute); }); page(defaultRoute, () => {}); page.start({ hashbang: true, dispatch: true, popstate: false });

Output: First time: https://localhost:8551/?s=1#!MYPAGE After refresh: https://localhost:8551/?s=1#!MYPAGE?s=1 Refresh again: https://localhost:8551/?s=1#!MYPAGE?s=1?s=1

matthewp commented 6 years ago

Oops, closed the wrong issue :P

matthewp commented 6 years ago

I just tested and this does not occur any more. Only get the one query string as part of the URL.

5im-0n commented 4 years ago

Somehow this happens again in latest master: https://i.vgy.me/h0ytkR.webm