Skip to content

Commit

Permalink
Merge pull request #502 from visionmedia/same-link
Browse files Browse the repository at this point in the history
Fix querystring prop in context when navigating to the same page
  • Loading branch information
matthewp committed Sep 8, 2018
2 parents 6a35283 + 0d64311 commit f48d3f1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
page.replace(path, e.state);
} else if (isLocation) {
var loc = page._window.location;
page.show(loc.pathname + loc.hash, undefined, undefined, false);
page.show(loc.pathname + loc.search + loc.hash, undefined, undefined, false);
}
};
})();
Expand Down
2 changes: 1 addition & 1 deletion page.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
page.replace(path, e.state);
} else if (isLocation) {
var loc = page._window.location;
page.show(loc.pathname + loc.hash, undefined, undefined, false);
page.show(loc.pathname + loc.search + loc.hash, undefined, undefined, false);
}
};
})();
Expand Down
2 changes: 1 addition & 1 deletion page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
page.replace(path, e.state);
} else if (isLocation) {
var loc = page._window.location;
page.show(loc.pathname + loc.hash, undefined, undefined, false);
page.show(loc.pathname + loc.search + loc.hash, undefined, undefined, false);
}
};
})();
Expand Down
15 changes: 15 additions & 0 deletions test/demos/back-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<title>Blank page</title>
<body>
<ul class="links">
<li><a class="current-page" href="./back-demo.html?key=val#hash">Click me</a></li>
</ul>

<script src="../page.js"></script>
<script>
page("/test/demos/back-demo.html", function(ctx){
console.assert(ctx.querystring === "key=val");
});
</script>
</body>

0 comments on commit f48d3f1

Please sign in to comment.