@samitouri / QOS-React-2 / commits / a17467e7e2

SchedulerPostTask: Reuse original TaskController (#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 ```

Noah Lemen committed Nov 2, 2023 at 11:03 UTC a17467e7e2cd8947c595d1834889b5d184459f12
1 file changed +1 -7
packages/scheduler/src/forks/SchedulerPostTask.js
+1 -7
@@ -129,15 +129,9 @@ function runTask<T>(
129 if (typeof result === 'function') {
130 // Assume this is a continuation
131 const continuation: SchedulerCallback<T> = (result: any);
132 - const continuationController = new TaskController({
133 - priority: postTaskPriority,
134 - });
132 const continuationOptions = {
136 - signal: continuationController.signal,
133 + signal: node._controller.signal,
134 };
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;
135
136 const nextTask = runTask.bind(
137 null,