Commit d9db635
committed
Flight support for Float
Supporting Float methods such as ReactDOM.preload() are challenging for flight because it does not have an easy means to convey direct executions in other environments. Because the flight wire format is a JSON-like serialization that is expected to be rendered it currently only describes renderable elements. We need a way to convey a function invocation that gets run in the context of the client environment whether that is Fizz or Fiber.
Fiber is somewhat straightforward because the HostDispatcher is always active and we can just have the FlightClient dispatch the serialized directive.
Fizz is much more challenging becaue the dispatcher is always scoped but the specific request the dispatch belongs to is not readily available. Environments that support AsyncLocalStorage (or in the future AsyncContext) we will use this to be able to resolve directives in Fizz to the appropriate Request. For other environments directives will be elided. Right now this is pragmatic and non-breaking because all directives are opportunistic and non-critical. If this changes in the future we will need to reconsider how widespread support for async context tracking is.
For Flight, if AsyncLocalStorage is available Float methods can be called before and after await points and be expected to work. If AsyncLocalStorage is not available float methods called in the sync phase of a component render will be captured but anything after an await point will be a noop. If a float call is dropped in this manner a DEV warning should help you realize your code may need to be modified.1 parent 0bdcfff commit d9db635
File tree
41 files changed
+913
-109
lines changed- packages
- react-client/src
- forks
- react-dom-bindings/src
- client
- server
- react-dom/src
- __tests__
- client
- react-native-renderer/src/server
- react-noop-renderer/src
- react-server-dom-relay/src
- react-server-dom-webpack/src/__tests__
- react-server-native-relay/src
- react-server/src
- forks
- scripts
- error-codes
- rollup
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+913
-109
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
761 | 771 | | |
762 | 772 | | |
763 | 773 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
1864 | 1865 | | |
1865 | 1866 | | |
1866 | 1867 | | |
1867 | | - | |
1868 | | - | |
1869 | | - | |
1870 | | - | |
1871 | 1868 | | |
1872 | 1869 | | |
1873 | 1870 | | |
| |||
1958 | 1955 | | |
1959 | 1956 | | |
1960 | 1957 | | |
1961 | | - | |
| 1958 | + | |
1962 | 1959 | | |
1963 | 1960 | | |
1964 | 1961 | | |
| |||
2032 | 2029 | | |
2033 | 2030 | | |
2034 | 2031 | | |
2035 | | - | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
2036 | 2036 | | |
2037 | 2037 | | |
2038 | 2038 | | |
| |||
2060 | 2060 | | |
2061 | 2061 | | |
2062 | 2062 | | |
2063 | | - | |
2064 | 2063 | | |
2065 | | - | |
| 2064 | + | |
2066 | 2065 | | |
2067 | 2066 | | |
2068 | 2067 | | |
| |||
2111 | 2110 | | |
2112 | 2111 | | |
2113 | 2112 | | |
2114 | | - | |
| 2113 | + | |
2115 | 2114 | | |
2116 | 2115 | | |
2117 | 2116 | | |
| |||
2124 | 2123 | | |
2125 | 2124 | | |
2126 | 2125 | | |
2127 | | - | |
2128 | 2126 | | |
2129 | | - | |
| 2127 | + | |
2130 | 2128 | | |
2131 | 2129 | | |
2132 | 2130 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
Lines changed: 71 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | | - | |
91 | 93 | | |
92 | 94 | | |
93 | | - | |
94 | | - | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
96 | 99 | | |
97 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
98 | 105 | | |
99 | | - | |
100 | 106 | | |
101 | 107 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
| |||
4490 | 4499 | | |
4491 | 4500 | | |
4492 | 4501 | | |
4493 | | - | |
4494 | | - | |
4495 | | - | |
4496 | | - | |
4497 | | - | |
4498 | | - | |
4499 | | - | |
| 4502 | + | |
| 4503 | + | |
| 4504 | + | |
| 4505 | + | |
| 4506 | + | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + | |
| 4510 | + | |
| 4511 | + | |
4500 | 4512 | | |
4501 | 4513 | | |
4502 | | - | |
4503 | 4514 | | |
4504 | 4515 | | |
4505 | 4516 | | |
| |||
4544 | 4555 | | |
4545 | 4556 | | |
4546 | 4557 | | |
4547 | | - | |
4548 | | - | |
4549 | | - | |
4550 | | - | |
4551 | | - | |
4552 | | - | |
4553 | | - | |
4554 | | - | |
| 4558 | + | |
| 4559 | + | |
| 4560 | + | |
| 4561 | + | |
| 4562 | + | |
| 4563 | + | |
| 4564 | + | |
| 4565 | + | |
| 4566 | + | |
| 4567 | + | |
| 4568 | + | |
4555 | 4569 | | |
4556 | 4570 | | |
4557 | | - | |
4558 | 4571 | | |
4559 | 4572 | | |
4560 | 4573 | | |
| |||
4603 | 4616 | | |
4604 | 4617 | | |
4605 | 4618 | | |
4606 | | - | |
4607 | 4619 | | |
4608 | | - | |
| 4620 | + | |
4609 | 4621 | | |
4610 | 4622 | | |
4611 | 4623 | | |
4612 | 4624 | | |
4613 | 4625 | | |
4614 | | - | |
4615 | | - | |
4616 | | - | |
4617 | | - | |
4618 | | - | |
4619 | | - | |
4620 | | - | |
| 4626 | + | |
| 4627 | + | |
| 4628 | + | |
| 4629 | + | |
| 4630 | + | |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
4621 | 4636 | | |
4622 | 4637 | | |
4623 | | - | |
4624 | 4638 | | |
4625 | 4639 | | |
4626 | 4640 | | |
| |||
4744 | 4758 | | |
4745 | 4759 | | |
4746 | 4760 | | |
4747 | | - | |
4748 | 4761 | | |
4749 | | - | |
| 4762 | + | |
4750 | 4763 | | |
4751 | 4764 | | |
4752 | 4765 | | |
4753 | 4766 | | |
4754 | 4767 | | |
4755 | | - | |
4756 | | - | |
4757 | | - | |
4758 | | - | |
4759 | | - | |
4760 | | - | |
4761 | | - | |
| 4768 | + | |
4762 | 4769 | | |
4763 | 4770 | | |
4764 | | - | |
| 4771 | + | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
| 4779 | + | |
| 4780 | + | |
4765 | 4781 | | |
4766 | 4782 | | |
4767 | 4783 | | |
| |||
4983 | 4999 | | |
4984 | 5000 | | |
4985 | 5001 | | |
4986 | | - | |
| 5002 | + | |
4987 | 5003 | | |
4988 | 5004 | | |
4989 | 5005 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
0 commit comments