-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
YUI Router pushes state before verifying a matching route #1722
Comments
It's been a little while since I was in Router, but changing the URL regardless of whether there are any matching routes is by design; if anything, it seems like the fault here is probably that we don't provide an easy way to handle this situation. Or have I misunderstood you? |
Yeah, so In the case of Pjax (which is what I think you're seeing here with Y.App and links), when a link is clicked it checks if any routes are matched, if there is one it will call A common problem with this is that you can setup a route handler for Here's a basic example app showing how you can get around this by overriding Router's The other thing I can think of is using Router's My guess is that one of these two things is causing the issue you see. |
Hi guys, thanks for the responses. We're using Router's We had a fallthrough Re: FWIW, #1723 isn't really a dupe, but perhaps is moot with the above change to |
Yeah, exactly. I'll get a PR up for a change to |
@ericf great. Would you mind pinging me on my corp account when that's up? Email or IM. |
…dlers The addition of router params in YUI 3.12.0 provided a way for extra validation of path params during a router's dispatching process. But at the time the router params feature was added, the `hasRouter()` method was not updated to follow suit. With these changes a router's `hasRoute()` method will process param values the same way its dispatching process does. This makes it an effective way to test whether a router *will* dispatch a given URL. **Note:** The `match()` method is left unchanged. Both the dispatching process and the `hasRoute()` method first call `match()` to get a collection of possible routes, from which they further process by checking whether each named param handler accepts or rejects a given param value. Closes yui#1722 Relates yui#1723
Deployed, looking good! Thanks again @ericf. |
Cool! I'll close this out… |
A
console.log()
just beforehistory.add
fires before aconsole.log()
just before a path is matched against a regex.This means that if a user clicks a link to a path on the current domain (routed by YUI App) that does not match any configured routes, the URL will update but navigation will not actually happen, essentially rendering the link broken.
The text was updated successfully, but these errors were encountered: