From ea175d49f95f54bd2fb9c8dc3ae181bc0cb0e4bb Mon Sep 17 00:00:00 2001 From: Tobe O Date: Mon, 27 Nov 2017 18:42:50 -0500 Subject: [PATCH] Caching at END of flatten --- lib/src/router.dart | 9 +++------ pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/src/router.dart b/lib/src/router.dart index 4c435e1e..e26ea599 100644 --- a/lib/src/router.dart +++ b/lib/src/router.dart @@ -229,9 +229,7 @@ class Router { var scanner = new SpanScanner(param.replaceAll(_straySlashes, '')); for (Route route in search.routes) { int pos = scanner.position; - if (route.parser - .parse(scanner) - .successful && scanner.isDone) { + if (route.parser.parse(scanner).successful && scanner.isDone) { segments.add(route.path.replaceAll(_straySlashes, '')); lastRoute = route; @@ -473,8 +471,7 @@ class _ChainedRouter extends Router { /// Optimizes a router by condensing all its routes into one level. Router flatten(Router router) { var flattened = new Router(debug: router.debug == true) - ..requestMiddleware.addAll(router.requestMiddleware) - ..enableCache(); + ..requestMiddleware.addAll(router.requestMiddleware); for (var route in router.routes) { if (route is SymlinkRoute) { @@ -496,5 +493,5 @@ Router flatten(Router router) { } } - return flattened; + return flattened..enableCache(); } diff --git a/pubspec.yaml b/pubspec.yaml index 1c43271a..c6abb050 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: angel_route description: A powerful, isomorphic routing library for Dart. -version: 2.0.3 +version: 2.0.3+1 author: Tobe O homepage: https://github.com/angel-dart/angel_route environment: