@samitouri / QOS-React / commits / bc30ef9842

Work around loose typing for fiber.updateQueue

The updateQueue field is currently an any type. Check the fiber's tag so that only UpdateQueues are passed to getPendingPriority.

Andrew Clark committed Mar 9, 2017 at 15:55 UTC bc30ef9842a5c2719828278aa8aa2e4df9575cda
1 file changed +7 -1
src/renderers/shared/fiber/ReactFiberScheduler.js
+7 -1
@@ -571,7 +571,13 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
571 // Check for pending update priority. This is usually null so it shouldn't
572 // be a perf issue.
573 const queue = workInProgress.updateQueue;
574 - if (queue !== null) {
574 + const tag = workInProgress.tag;
575 + if (
576 + queue !== null &&
577 + // TODO: Revisit once updateQueue is typed properly to distinguish between
578 + // update payloads for host components and update queues for composites
579 + (tag === ClassComponent || tag === HostRoot)
580 + ) {
581 newPriority = getPendingPriority(queue);
582 }
583