Skip to content

Commit

Permalink
SchedulerPostTask: Reuse original TaskController (facebook#27595)
Browse files Browse the repository at this point in the history
## Summary

It's not clear to me why we currently create a new TaskController in
`runTask` – ultimately, we use the same signal and priority from the
original created in `unstable_scheduleCallback`

## How did you test this change?
```
yarn test SchedulerPostTask
```
  • Loading branch information
noahlemen authored and AndyPengc12 committed Apr 15, 2024
1 parent 4bf9871 commit de62805
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/scheduler/src/forks/SchedulerPostTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,9 @@ function runTask<T>(
if (typeof result === 'function') {
// Assume this is a continuation
const continuation: SchedulerCallback<T> = (result: any);
const continuationController = new TaskController({
priority: postTaskPriority,
});
const continuationOptions = {
signal: continuationController.signal,
signal: node._controller.signal,
};
// Update the original callback node's controller, since even though we're
// posting a new task, conceptually it's the same one.
node._controller = continuationController;

const nextTask = runTask.bind(
null,
Expand Down

0 comments on commit de62805

Please sign in to comment.