Commit 3c7e637
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 2d25a2d commit 3c7e637
File tree
13 files changed
+467
-628
lines changed- goldens/circular-deps
- packages
- core/test/bundling/router
- router
- src
- operators
- test
13 files changed
+467
-628
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 | | |
| |||
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 | | |
| |||
476 | 473 | | |
477 | 474 | | |
478 | 475 | | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | 476 | | |
483 | 477 | | |
484 | 478 | | |
| |||
740 | 734 | | |
741 | 735 | | |
742 | 736 | | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | 737 | | |
747 | 738 | | |
748 | 739 | | |
| |||
1067 | 1058 | | |
1068 | 1059 | | |
1069 | 1060 | | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1070 | 1064 | | |
1071 | 1065 | | |
1072 | 1066 | | |
1073 | 1067 | | |
1074 | 1068 | | |
1075 | 1069 | | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1076 | 1073 | | |
1077 | 1074 | | |
1078 | 1075 | | |
| |||
1352 | 1349 | | |
1353 | 1350 | | |
1354 | 1351 | | |
1355 | | - | |
1356 | | - | |
1357 | | - | |
1358 | 1352 | | |
1359 | 1353 | | |
1360 | 1354 | | |
| |||
1562 | 1556 | | |
1563 | 1557 | | |
1564 | 1558 | | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
1568 | 1559 | | |
1569 | 1560 | | |
1570 | 1561 | | |
| |||
1628 | 1619 | | |
1629 | 1620 | | |
1630 | 1621 | | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
1634 | 1622 | | |
1635 | 1623 | | |
1636 | 1624 | | |
| |||
1733 | 1721 | | |
1734 | 1722 | | |
1735 | 1723 | | |
1736 | | - | |
1737 | | - | |
1738 | | - | |
1739 | 1724 | | |
1740 | 1725 | | |
1741 | 1726 | | |
| |||
1868 | 1853 | | |
1869 | 1854 | | |
1870 | 1855 | | |
1871 | | - | |
1872 | | - | |
1873 | | - | |
1874 | 1856 | | |
1875 | 1857 | | |
1876 | 1858 | | |
| |||
1946 | 1928 | | |
1947 | 1929 | | |
1948 | 1930 | | |
1949 | | - | |
1950 | | - | |
1951 | | - | |
1952 | 1931 | | |
1953 | 1932 | | |
1954 | 1933 | | |
| |||
0 commit comments