Commit 83102b6
committed
[Scheduler] Canceling an already running task
Canceling an already running task is currently a no-op. It does not
cause the task to yield execution, and if the task does yield with
a continuation, then the continuation will run.
This change addresses both parts: canceling the current task causes
`shouldYield` to return `true`, and if the canceled task returns a
continuation, the continuation is ignored.
This fixes the regression test introduced in the preceding commit.
There's likely a better way to model a restart of an in-progress
render, but this approach is conceptually similar to how a regular
high priority interruption already works.1 parent 8e2dd67 commit 83102b6
File tree
4 files changed
+51
-10
lines changed- packages
- react-reconciler/src
- scheduler/src
- __tests__
4 files changed
+51
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2046 | 2046 | | |
2047 | 2047 | | |
2048 | 2048 | | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
2049 | 2058 | | |
2050 | | - | |
2051 | 2059 | | |
2052 | 2060 | | |
2053 | 2061 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
518 | 521 | | |
519 | 522 | | |
520 | 523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
187 | | - | |
188 | | - | |
189 | | - | |
| 189 | + | |
| 190 | + | |
190 | 191 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
197 | 203 | | |
198 | 204 | | |
199 | 205 | | |
| |||
389 | 395 | | |
390 | 396 | | |
391 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
392 | 401 | | |
393 | 402 | | |
394 | 403 | | |
| |||
406 | 415 | | |
407 | 416 | | |
408 | 417 | | |
| 418 | + | |
409 | 419 | | |
410 | 420 | | |
411 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
291 | 311 | | |
292 | 312 | | |
293 | 313 | | |
| |||
0 commit comments