-
Notifications
You must be signed in to change notification settings - Fork 105
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
"Route not found" event #22
Comments
Ooops, I see it's even stranger.
First. It's not documented how I have this code: import {Router5} from "router5";
let router = new Router5(undefined, {
useHash: false,
defaultRoute: "ginger",
});
router
.addNode("home", "/")
.addNode("ginger", "/ginger");
function handleAll(toState, fromState) {
console.log("handleAll()");
console.log("toState:", toState);
console.log("fromState:", fromState);
}
router.addListener(handleAll);
router.start(); Let's try what this code does at access to It suddenly redirects me to Expected (at least to me) behavior would be to raise "Not found" event. Is this a bug or... magic? |
For not found: http://router5.github.io/docs/transition.html
|
Well it is not really a bug, but it could definitely be improved. So far the router assumes that if you managed to load |
@troch if I just access Next I try: function handleErrors(err) {
console.log("error:", err);
}
router.onTransitionError(handleErrors);
router.navigate("dfdf");
What am I doing wrong? |
function handleErrors(toState, fromState, err) {
console.log("error:", err);
} |
I know why it is not called, needs to be fixed |
Thanks for raising those issues 👍 , a few points have been improved with 0.6.0 (just released). |
Oops didn't mean to reopen |
@troch, thank you for this project! I really appreciate your work. |
Thanks for your kind words! |
Suppose we're on the page
/about
which is not declared in the routes.We want to display "page-not-found" widget (component) in this case.
We add listeners but router is silent if no routes matched. Why?
Shouldn't it raise an event with some special
toState
ortoState == undefined
right afterrouter.start()
to notify about this case? I was pretty sure Not found is the same valid and crucial information as Found to listen to. Did I miss something in the docs?The text was updated successfully, but these errors were encountered: