Skip to content

Commit 4e05e5c

Browse files
committed
perf(NgRoutingHelper): reverse the portal list order
Then we can use firstWhere() instead of lastWhere()
1 parent 4563f72 commit 4e05e5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/routing/routing.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class NgRoutingHelper {
181181
var viewDef = _templates[path];
182182
if (viewDef == null) continue;
183183

184-
NgView view = _portals.lastWhere(
184+
NgView view = _portals.firstWhere(
185185
(NgView v) => path != _routePath(v._parentRoute) &&
186186
path.startsWith(_routePath(v._parentRoute)),
187187
orElse: () => null);
@@ -199,7 +199,7 @@ class NgRoutingHelper {
199199
}
200200

201201
void _registerPortal(NgView ngView) {
202-
_portals.add(ngView);
202+
_portals.insert(0, ngView);
203203
}
204204

205205
void _unregisterPortal(NgView ngView) {

0 commit comments

Comments
 (0)