Skip to content

Commit

Permalink
SchedulerPostTask: Reuse original TaskController (#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 Nov 2, 2023
1 parent faa6577 commit a17467e
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 a17467e

Please sign in to comment.