Commit b0c1dc0
authored
[Flight] Add approximate parent context for FormatContext (facebook#34601)
Flight doesn't have any semantically sound notion of a parent context.
That's why we removed Server Context. Each root can really start
anywhere in the tree when you refetch subtrees. Additionally when you
dedupe elements they can end up in multiple different parent contexts.
However, we do have a DEV only version of this with debugTask being
tracked for the nearest parent element to track the context of
properties inside of it.
To apply certain DOM specific hints and optimizations when you render
host components we need some information of the context. This is usually
very local so doesn't suffer from the likelihood that you refetch in the
middle. We'll also only use this information for optimistic hints and
not hard semantics so getting it wrong isn't terrible.
```
<picture>
<img />
</picture>
<noscript>
<p>
<img />
</p>
</noscript>
```
For example, in these cases we should exclude preloading the image but
we have to know if that's the scope we're in.
We can easily get this wrong if they're split or even if they're wrapped
in client components that we don't know about like:
```
<NoScript>
<p>
<img />
</p>
</NoScript>
```
However, getting it wrong in either direction is not the end of the
world. It's about covering the common cases well.1 parent 6eb5d67 commit b0c1dc0
File tree
5 files changed
+101
-0
lines changed- packages
- react-dom-bindings/src/server
- react-server/src
- forks
5 files changed
+101
-0
lines changedLines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
525 | 528 | | |
526 | 529 | | |
527 | 530 | | |
| 531 | + | |
528 | 532 | | |
529 | 533 | | |
530 | 534 | | |
| |||
758 | 762 | | |
759 | 763 | | |
760 | 764 | | |
| 765 | + | |
761 | 766 | | |
762 | 767 | | |
763 | 768 | | |
| |||
980 | 985 | | |
981 | 986 | | |
982 | 987 | | |
| 988 | + | |
983 | 989 | | |
984 | 990 | | |
985 | 991 | | |
| |||
1102 | 1108 | | |
1103 | 1109 | | |
1104 | 1110 | | |
| 1111 | + | |
1105 | 1112 | | |
1106 | 1113 | | |
1107 | 1114 | | |
| |||
1197 | 1204 | | |
1198 | 1205 | | |
1199 | 1206 | | |
| 1207 | + | |
1200 | 1208 | | |
1201 | 1209 | | |
1202 | 1210 | | |
| |||
2028 | 2036 | | |
2029 | 2037 | | |
2030 | 2038 | | |
| 2039 | + | |
2031 | 2040 | | |
2032 | 2041 | | |
2033 | 2042 | | |
| |||
2048 | 2057 | | |
2049 | 2058 | | |
2050 | 2059 | | |
| 2060 | + | |
2051 | 2061 | | |
2052 | 2062 | | |
2053 | 2063 | | |
| |||
2214 | 2224 | | |
2215 | 2225 | | |
2216 | 2226 | | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
2217 | 2243 | | |
2218 | 2244 | | |
2219 | 2245 | | |
| |||
2530 | 2556 | | |
2531 | 2557 | | |
2532 | 2558 | | |
| 2559 | + | |
2533 | 2560 | | |
2534 | 2561 | | |
2535 | 2562 | | |
| |||
2554 | 2581 | | |
2555 | 2582 | | |
2556 | 2583 | | |
| 2584 | + | |
2557 | 2585 | | |
2558 | 2586 | | |
2559 | 2587 | | |
| |||
2819 | 2847 | | |
2820 | 2848 | | |
2821 | 2849 | | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
2822 | 2864 | | |
2823 | 2865 | | |
2824 | 2866 | | |
2825 | 2867 | | |
2826 | 2868 | | |
| 2869 | + | |
2827 | 2870 | | |
2828 | 2871 | | |
2829 | 2872 | | |
| |||
3071 | 3114 | | |
3072 | 3115 | | |
3073 | 3116 | | |
| 3117 | + | |
3074 | 3118 | | |
3075 | 3119 | | |
3076 | 3120 | | |
| |||
3208 | 3252 | | |
3209 | 3253 | | |
3210 | 3254 | | |
| 3255 | + | |
3211 | 3256 | | |
3212 | 3257 | | |
3213 | 3258 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
22 | 36 | | |
23 | 37 | | |
24 | 38 | | |
| |||
0 commit comments