Caching at END of flatten
This commit is contained in:
parent
b08bca3d6f
commit
ea175d49f9
2 changed files with 4 additions and 7 deletions
|
@ -229,9 +229,7 @@ class Router {
|
||||||
var scanner = new SpanScanner(param.replaceAll(_straySlashes, ''));
|
var scanner = new SpanScanner(param.replaceAll(_straySlashes, ''));
|
||||||
for (Route route in search.routes) {
|
for (Route route in search.routes) {
|
||||||
int pos = scanner.position;
|
int pos = scanner.position;
|
||||||
if (route.parser
|
if (route.parser.parse(scanner).successful && scanner.isDone) {
|
||||||
.parse(scanner)
|
|
||||||
.successful && scanner.isDone) {
|
|
||||||
segments.add(route.path.replaceAll(_straySlashes, ''));
|
segments.add(route.path.replaceAll(_straySlashes, ''));
|
||||||
lastRoute = route;
|
lastRoute = route;
|
||||||
|
|
||||||
|
@ -473,8 +471,7 @@ class _ChainedRouter extends Router {
|
||||||
/// Optimizes a router by condensing all its routes into one level.
|
/// Optimizes a router by condensing all its routes into one level.
|
||||||
Router flatten(Router router) {
|
Router flatten(Router router) {
|
||||||
var flattened = new Router(debug: router.debug == true)
|
var flattened = new Router(debug: router.debug == true)
|
||||||
..requestMiddleware.addAll(router.requestMiddleware)
|
..requestMiddleware.addAll(router.requestMiddleware);
|
||||||
..enableCache();
|
|
||||||
|
|
||||||
for (var route in router.routes) {
|
for (var route in router.routes) {
|
||||||
if (route is SymlinkRoute) {
|
if (route is SymlinkRoute) {
|
||||||
|
@ -496,5 +493,5 @@ Router flatten(Router router) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return flattened;
|
return flattened..enableCache();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: angel_route
|
name: angel_route
|
||||||
description: A powerful, isomorphic routing library for Dart.
|
description: A powerful, isomorphic routing library for Dart.
|
||||||
version: 2.0.3
|
version: 2.0.3+1
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_route
|
homepage: https://github.com/angel-dart/angel_route
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue