Commit 2e669b3
committed
Track search string as part of "refresh state"
When a parallel route does not match the current URL, in its place we
render the render the last active route that matched that slot. When
we next refresh the page, we track some additional state to inform the
router how to refresh the old, "inactive" routes that aren't reachable
from the outermost, "active" route.
Before this PR, the only state we tracked was the URL of the page that
last matched the inactive segment. After this PR, I am also tracking
the search query string of the old route. This can't be inferred from
the URL alone because the URL may have been rewritten by the server.
We don't need the search query to perform a network request — that
is handled by the URL alone — but we do need it in order to construct
a cache key for the page segments. Today we read the cache key from
the FlightRouterState, which has all the params embdeed inside of it,
but eventually I want to remove all uses of FlightRouterState that
aren't about sending/receiving data from the server or storing the
tree as state in the browser's history entry. So this is an incremental
step towards that goal.1 parent 4112472 commit 2e669b3
File tree
10 files changed
+85
-70
lines changed- packages/next/src
- client
- components
- router-reducer
- reducers
- segment-cache
10 files changed
+85
-70
lines changedLines changed: 35 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| 179 | + | |
178 | 180 | | |
179 | 181 | | |
180 | 182 | | |
| |||
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
192 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
193 | 199 | | |
194 | 200 | | |
195 | 201 | | |
| |||
207 | 213 | | |
208 | 214 | | |
209 | 215 | | |
210 | | - | |
| 216 | + | |
| 217 | + | |
211 | 218 | | |
212 | 219 | | |
213 | 220 | | |
| |||
229 | 236 | | |
230 | 237 | | |
231 | 238 | | |
232 | | - | |
| 239 | + | |
| 240 | + | |
233 | 241 | | |
234 | 242 | | |
235 | 243 | | |
| |||
441 | 449 | | |
442 | 450 | | |
443 | 451 | | |
444 | | - | |
445 | | - | |
446 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
447 | 455 | | |
448 | 456 | | |
449 | | - | |
| 457 | + | |
450 | 458 | | |
451 | | - | |
| 459 | + | |
452 | 460 | | |
453 | 461 | | |
454 | 462 | | |
455 | 463 | | |
456 | | - | |
457 | | - | |
| 464 | + | |
| 465 | + | |
458 | 466 | | |
459 | 467 | | |
460 | 468 | | |
| |||
519 | 527 | | |
520 | 528 | | |
521 | 529 | | |
522 | | - | |
| 530 | + | |
523 | 531 | | |
524 | 532 | | |
525 | 533 | | |
| |||
556 | 564 | | |
557 | 565 | | |
558 | 566 | | |
559 | | - | |
| 567 | + | |
| 568 | + | |
560 | 569 | | |
561 | 570 | | |
562 | 571 | | |
| |||
613 | 622 | | |
614 | 623 | | |
615 | 624 | | |
616 | | - | |
| 625 | + | |
617 | 626 | | |
618 | 627 | | |
619 | 628 | | |
| |||
918 | 927 | | |
919 | 928 | | |
920 | 929 | | |
921 | | - | |
| 930 | + | |
922 | 931 | | |
923 | 932 | | |
924 | 933 | | |
| |||
981 | 990 | | |
982 | 991 | | |
983 | 992 | | |
984 | | - | |
| 993 | + | |
985 | 994 | | |
986 | 995 | | |
987 | 996 | | |
| |||
993 | 1002 | | |
994 | 1003 | | |
995 | 1004 | | |
| 1005 | + | |
996 | 1006 | | |
997 | 1007 | | |
998 | 1008 | | |
| |||
1002 | 1012 | | |
1003 | 1013 | | |
1004 | 1014 | | |
1005 | | - | |
| 1015 | + | |
1006 | 1016 | | |
1007 | 1017 | | |
1008 | 1018 | | |
1009 | 1019 | | |
1010 | 1020 | | |
1011 | 1021 | | |
1012 | 1022 | | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | 1023 | | |
1018 | 1024 | | |
1019 | | - | |
1020 | | - | |
| 1025 | + | |
| 1026 | + | |
1021 | 1027 | | |
1022 | | - | |
| 1028 | + | |
1023 | 1029 | | |
1024 | 1030 | | |
1025 | | - | |
1026 | | - | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1027 | 1034 | | |
1028 | 1035 | | |
1029 | 1036 | | |
1030 | 1037 | | |
1031 | | - | |
1032 | | - | |
| 1038 | + | |
1033 | 1039 | | |
1034 | 1040 | | |
1035 | 1041 | | |
| |||
1626 | 1632 | | |
1627 | 1633 | | |
1628 | 1634 | | |
1629 | | - | |
| 1635 | + | |
1630 | 1636 | | |
1631 | 1637 | | |
1632 | 1638 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| |||
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
| 429 | + | |
428 | 430 | | |
429 | 431 | | |
430 | 432 | | |
| |||
446 | 448 | | |
447 | 449 | | |
448 | 450 | | |
| 451 | + | |
449 | 452 | | |
450 | 453 | | |
451 | 454 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
225 | 234 | | |
| 235 | + | |
226 | 236 | | |
227 | 237 | | |
228 | 238 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| 171 | + | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
| |||
193 | 196 | | |
194 | 197 | | |
195 | 198 | | |
| 199 | + | |
196 | 200 | | |
197 | 201 | | |
198 | 202 | | |
| |||
209 | 213 | | |
210 | 214 | | |
211 | 215 | | |
| 216 | + | |
212 | 217 | | |
213 | 218 | | |
214 | 219 | | |
| |||
225 | 230 | | |
226 | 231 | | |
227 | 232 | | |
| 233 | + | |
228 | 234 | | |
229 | 235 | | |
230 | 236 | | |
| |||
259 | 265 | | |
260 | 266 | | |
261 | 267 | | |
| 268 | + | |
262 | 269 | | |
263 | 270 | | |
264 | 271 | | |
| |||
287 | 294 | | |
288 | 295 | | |
289 | 296 | | |
| 297 | + | |
290 | 298 | | |
291 | 299 | | |
292 | 300 | | |
| |||
483 | 491 | | |
484 | 492 | | |
485 | 493 | | |
| 494 | + | |
486 | 495 | | |
487 | 496 | | |
488 | 497 | | |
| |||
558 | 567 | | |
559 | 568 | | |
560 | 569 | | |
| 570 | + | |
561 | 571 | | |
562 | 572 | | |
563 | 573 | | |
| |||
0 commit comments