Commit 1600687
committed
fix(router): Route matching should only happen once when navigating (#49163)
When navigating in the Router, the current approach does the redirects
and the creation of the `RouterStateSnapshot` in two separate steps
(applyRedirects and recognize). These two steps duplicate the route
matching logic, resulting in user code on routes being executing twice
(custom `UrlMatcher` and `canMatch` guards). This also duplicates the
complex matching logic in two places, which increases the bundle size
and maintenance burden.
This commit combines the `applyRedirects` and `recognize` steps into a
single matching algorithm.
fixes #26081
PR Close #491631 parent be23b7c commit 1600687
File tree
14 files changed
+468
-629
lines changed- goldens
- circular-deps
- size-tracking
- packages
- core/test/bundling/router
- router
- src
- operators
- test
14 files changed
+468
-629
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | 289 | | |
296 | 290 | | |
297 | 291 | | |
| |||
311 | 305 | | |
312 | 306 | | |
313 | 307 | | |
314 | | - | |
| 308 | + | |
315 | 309 | | |
316 | 310 | | |
317 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
Lines changed: 6 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
| |||
473 | 470 | | |
474 | 471 | | |
475 | 472 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | 473 | | |
480 | 474 | | |
481 | 475 | | |
| |||
734 | 728 | | |
735 | 729 | | |
736 | 730 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | 731 | | |
741 | 732 | | |
742 | 733 | | |
| |||
1061 | 1052 | | |
1062 | 1053 | | |
1063 | 1054 | | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1064 | 1058 | | |
1065 | 1059 | | |
1066 | 1060 | | |
1067 | 1061 | | |
1068 | 1062 | | |
1069 | 1063 | | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
1070 | 1067 | | |
1071 | 1068 | | |
1072 | 1069 | | |
| |||
1346 | 1343 | | |
1347 | 1344 | | |
1348 | 1345 | | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | 1346 | | |
1353 | 1347 | | |
1354 | 1348 | | |
| |||
1556 | 1550 | | |
1557 | 1551 | | |
1558 | 1552 | | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
1562 | 1553 | | |
1563 | 1554 | | |
1564 | 1555 | | |
| |||
1622 | 1613 | | |
1623 | 1614 | | |
1624 | 1615 | | |
1625 | | - | |
1626 | | - | |
1627 | | - | |
1628 | 1616 | | |
1629 | 1617 | | |
1630 | 1618 | | |
| |||
1727 | 1715 | | |
1728 | 1716 | | |
1729 | 1717 | | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
1733 | 1718 | | |
1734 | 1719 | | |
1735 | 1720 | | |
| |||
1862 | 1847 | | |
1863 | 1848 | | |
1864 | 1849 | | |
1865 | | - | |
1866 | | - | |
1867 | | - | |
1868 | 1850 | | |
1869 | 1851 | | |
1870 | 1852 | | |
| |||
1940 | 1922 | | |
1941 | 1923 | | |
1942 | 1924 | | |
1943 | | - | |
1944 | | - | |
1945 | | - | |
1946 | 1925 | | |
1947 | 1926 | | |
1948 | 1927 | | |
| |||
0 commit comments