From 5ab71d16b1bfc3baef7158424db4099421d74df6 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Fri, 30 Dec 2016 17:37:06 -0800 Subject: [PATCH] Update README.md --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b095f692ad..efc5ae24fc 100644 --- a/README.md +++ b/README.md @@ -282,21 +282,13 @@ If you are no longer want to listen to that event, you can simply unset the even Router.onRouteChangeStart = null ``` -##### Cancelled (Abort) Routes - -Sometimes, you might want to change a route before the current route gets completed. Current route may be downloading the page or running `getInitialProps`. -In that case, we abort the current route and process with the new route. - -If you need, you could capture those cancelled routes via `routeChangeError` router event. See: +If a route load is cancelled (for example by clicking two links rapidly in succession), `routeChangeError` will fire. The passed `err` will contained a `cancelled` property set to `true`. ```js Router.onRouteChangeError = (err, url) => { if (err.cancelled) { - console.log(`Route to ${url} is cancelled!`) - return + console.log(`Route to ${url} was cancelled!`) } - - // Some other error } ``` -- GitLab