From 8090cf59e38653bf611d04f510b3ca32434e3d47 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Wed, 28 Dec 2016 21:02:50 -0800 Subject: [PATCH] Allow performWork to be called recursively Currently we assume that performWork is never called recursively. Ideally that is the case. We shouldn't rely on recursion anywhere in Fiber. However, to support the use of syncUpdates as an opt-in to forced- synchronous updates, we need the ability to call performWork recursively. At the beginning of performWork, the state of the scheduler is saved; before exiting, that state is restored, so that the scheduler can continue where it left off. I've decided to use local variables to stash the previous state. We could also store them in a record and push it to a stack, but this approach has the advantage of being isolated to performWork. --- .../shared/fiber/ReactFiberScheduler.js | 55 +++++++++++++------ 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/src/renderers/shared/fiber/ReactFiberScheduler.js b/src/renderers/shared/fiber/ReactFiberScheduler.js index bc14bf3693..b4a8aeb7e6 100644 --- a/src/renderers/shared/fiber/ReactFiberScheduler.js +++ b/src/renderers/shared/fiber/ReactFiberScheduler.js @@ -672,10 +672,29 @@ module.exports = function(config : HostConfig(config : HostConfig