Skip to content

Commit de62805

Browse files
noahlemenAndyPengc12
authored andcommitted
SchedulerPostTask: Reuse original TaskController (facebook#27595)
## 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 ```
1 parent 4bf9871 commit de62805

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

packages/scheduler/src/forks/SchedulerPostTask.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,9 @@ function runTask<T>(
129129
if (typeof result === 'function') {
130130
// Assume this is a continuation
131131
const continuation: SchedulerCallback<T> = (result: any);
132-
const continuationController = new TaskController({
133-
priority: postTaskPriority,
134-
});
135132
const continuationOptions = {
136-
signal: continuationController.signal,
133+
signal: node._controller.signal,
137134
};
138-
// Update the original callback node's controller, since even though we're
139-
// posting a new task, conceptually it's the same one.
140-
node._controller = continuationController;
141135

142136
const nextTask = runTask.bind(
143137
null,

0 commit comments

Comments
 (0)