From 29696a26eb3f42b3310b42ff26395598ffc1a69d Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Mon, 13 Apr 2015 11:19:28 -0700 Subject: [PATCH] React Native: Fix InteractionManager Race Condition --- Libraries/Interaction/InteractionManager.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Libraries/Interaction/InteractionManager.js b/Libraries/Interaction/InteractionManager.js index 6aef690dd1..93c384d23e 100644 --- a/Libraries/Interaction/InteractionManager.js +++ b/Libraries/Interaction/InteractionManager.js @@ -119,6 +119,8 @@ function scheduleUpdate() { * Notify listeners, process queue, etc */ function processUpdate() { + _nextUpdateHandle = null; + var interactionCount = _interactionSet.size; _addInteractionSet.forEach(handle => _interactionSet.add(handle) @@ -138,12 +140,13 @@ function processUpdate() { // process the queue regardless of a transition if (nextInteractionCount === 0) { - _queue.forEach(callback => { + var queue = _queue; + _queue = []; + queue.forEach(callback => { ErrorUtils.applyWithGuard(callback); }); - _queue = []; } - _nextUpdateHandle = null; + _addInteractionSet.clear(); _deleteInteractionSet.clear(); }