Commit 20d783c
committed
fix: don't redirect in forks
This prevents a redirect that a remote function could do from doing a navigation in a fork. Leverages Svelte's new forking methods from sveltejs/svelte#17217
It's implemented by putting the context into fork, pulling it out on remote function invocation to check if we're in a fork (TODO what if you have it invoked elsewhere and you just await it in a fork context?), put that into a map, and pull it out of there when a redirect occurs to check if the remote function is only called in context of that fork, and if so instead of redirecting we tell the SvelteKit router that this new route will redirect elsewhere. In the future we could follow that redirect and run it in the fork, but this is good enough for now and ties nicely into the current SvelteKit router.
Fixes #149351 parent ab37849 commit 20d783c
File tree
5 files changed
+87
-15
lines changed- .changeset
- packages/kit/src
- core/sync
- runtime/client
- remote-functions
5 files changed
+87
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
286 | 286 | | |
| 287 | + | |
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
| |||
540 | 541 | | |
541 | 542 | | |
542 | 543 | | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
547 | 559 | | |
548 | 560 | | |
549 | 561 | | |
| |||
1855 | 1867 | | |
1856 | 1868 | | |
1857 | 1869 | | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
1858 | 1880 | | |
1859 | 1881 | | |
1860 | 1882 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
Lines changed: 49 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | | - | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
33 | 54 | | |
34 | 55 | | |
35 | 56 | | |
| |||
43 | 64 | | |
44 | 65 | | |
45 | 66 | | |
46 | | - | |
| 67 | + | |
47 | 68 | | |
48 | 69 | | |
49 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
50 | 79 | | |
51 | 80 | | |
52 | 81 | | |
53 | 82 | | |
54 | 83 | | |
55 | 84 | | |
56 | 85 | | |
57 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
58 | 90 | | |
59 | 91 | | |
60 | 92 | | |
61 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
62 | 102 | | |
63 | 103 | | |
64 | 104 | | |
| |||
74 | 114 | | |
75 | 115 | | |
76 | 116 | | |
77 | | - | |
| 117 | + | |
| 118 | + | |
78 | 119 | | |
79 | 120 | | |
80 | 121 | | |
| |||
84 | 125 | | |
85 | 126 | | |
86 | 127 | | |
| 128 | + | |
87 | 129 | | |
88 | 130 | | |
89 | 131 | | |
| |||
0 commit comments