Commit 49b525d
committed
Import Scheduler directly, not via host config
We currently schedule asynchronous tasks via the host config. (The host
config is a static/build-time dependency injection system that varies
across different renderers — DOM, native, test, and so on.) Instead of
calling platform APIs like `requestIdleCallback` directly, each renderer
implements a method called `scheduleDeferredCallback`.
We've since discovered that when scheduling tasks, it's crucial that
React work is placed in the same queue as other, non-React work on the
main thread. Otherwise, you easily end up in a starvation scenario where
rendering is constantly interrupted by less important tasks. You need a
centralized coordinator that is used both by React and by other
frameworks and application code. This coordinator must also have a
consistent API across all the different host environments, for
convention's sake and so product code is portable — e.g. so the same
component can work in both React Native and React Native Web.
This turned into the Scheduler package. We will have different builds of
Scheduler for each of our target platforms. With this approach, we treat
Scheduler like a built-in platform primitive that exists wherever React
is supported.
Now that we have this consistent interface, the indirection of the host
config no longer makes sense for the purpose of scheduling tasks. In
fact, we explicitly do not want renderers to scheduled task via any
system except the Scheduler package.
So, this PR removes `scheduleDeferredCallback` and its associated
methods from the host config in favor of directly importing Scheduler.1 parent 5d49daf commit 49b525d
File tree
11 files changed
+24
-123
lines changed- packages
- react-art/src
- react-dom/src/client
- react-native-renderer/src
- react-noop-renderer/src
- react-reconciler/src
- forks
- react-test-renderer/src
- react/src/__tests__
11 files changed
+24
-123
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
347 | | - | |
348 | 346 | | |
349 | 347 | | |
350 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
315 | 313 | | |
316 | 314 | | |
317 | 315 | | |
| |||
Lines changed: 0 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 23 | | |
30 | 24 | | |
31 | 25 | | |
| |||
333 | 327 | | |
334 | 328 | | |
335 | 329 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | 330 | | |
341 | 331 | | |
342 | 332 | | |
343 | 333 | | |
344 | | - | |
345 | | - | |
346 | 334 | | |
347 | 335 | | |
348 | 336 | | |
| |||
Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 0 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 26 | | |
33 | 27 | | |
34 | 28 | | |
| |||
234 | 228 | | |
235 | 229 | | |
236 | 230 | | |
237 | | - | |
238 | 231 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | 232 | | |
243 | 233 | | |
244 | 234 | | |
245 | 235 | | |
246 | | - | |
247 | | - | |
248 | 236 | | |
249 | 237 | | |
250 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | 307 | | |
313 | 308 | | |
314 | 309 | | |
315 | 310 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | 311 | | |
320 | 312 | | |
321 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
| |||
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | 79 | | |
86 | 80 | | |
87 | 81 | | |
88 | 82 | | |
89 | 83 | | |
90 | | - | |
91 | | - | |
92 | 84 | | |
93 | 85 | | |
94 | 86 | | |
| |||
172 | 164 | | |
173 | 165 | | |
174 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
598 | 599 | | |
599 | 600 | | |
600 | 601 | | |
601 | | - | |
| 602 | + | |
602 | 603 | | |
603 | 604 | | |
604 | 605 | | |
| |||
807 | 808 | | |
808 | 809 | | |
809 | 810 | | |
810 | | - | |
| 811 | + | |
811 | 812 | | |
812 | 813 | | |
813 | 814 | | |
| |||
1978 | 1979 | | |
1979 | 1980 | | |
1980 | 1981 | | |
1981 | | - | |
| 1982 | + | |
1982 | 1983 | | |
1983 | 1984 | | |
1984 | 1985 | | |
| |||
1990 | 1991 | | |
1991 | 1992 | | |
1992 | 1993 | | |
1993 | | - | |
| 1994 | + | |
1994 | 1995 | | |
1995 | 1996 | | |
1996 | 1997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | 54 | | |
58 | 55 | | |
59 | 56 | | |
60 | | - | |
61 | | - | |
62 | 57 | | |
63 | 58 | | |
64 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
195 | 194 | | |
196 | 195 | | |
197 | 196 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | 197 | | |
205 | 198 | | |
206 | 199 | | |
207 | 200 | | |
208 | | - | |
209 | | - | |
210 | 201 | | |
211 | 202 | | |
212 | 203 | | |
| |||
0 commit comments