-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect path detection #191
Comments
I'm interested in working on a PR for this, but I've not been able to replicate it in either Chrome or Firefox. This is the test page I've used:
Console outputs accessing "#/search/notlocations/d": Similarly, for "#/search/locations/d": Could you provide some sample code that demonstrates the problem please? |
There is a new version 8.0.0 of the library and the bug can't be reproduced there. Navigo got re-written so probably the new implementation fixed the problem. Here's an example which works as expected: <div>
<a href="/search/locations/d" data-navigo>one</a>
<a href="/search/notlocations/d" data-navigo>two</a>
</div>
<hr />
<div id="content"></div>
<script src="/navigo.js"></script>
<script>
window.addEventListener("load", () => {
const router = new Navigo("/");
const render = (content) =>
(document.querySelector("#content").innerHTML = content);
router.on({
"/search/:v/:q": {
as: "search",
uses: function (match) {
render("Search " + JSON.stringify(match.data));
},
},
"/locations": {
as: "home",
uses: function () {
render("Home");
},
},
});
});
</script> P.S. |
Hello.
Today found some ugly bug.
Sample:
router.on({ '/search/:v/:q': { as: 'search', uses: function () { console.log('search', arguments[0]); } }, '/locations': { as: 'home', uses: function () { console.log('root'); } } });
The route search will never work if in its parametrized url will be string '/locations', which is another route path. The callback is never called
In other words, navigation to
http://127.0.0.1:8080/#/search/locations/d
does not trigger callback, however,http://127.0.0.1:8080/#/search/notlocations/d
will workThe text was updated successfully, but these errors were encountered: