From 420b58a7cba42e642f7eab0d1bc92f9d912a9864 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 9 Oct 2017 20:01:49 +0100 Subject: [PATCH] Check alternates when comparing to the common ancestor This is the actual bugfix. --- src/renderers/shared/shared/ReactTreeTraversal.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/renderers/shared/shared/ReactTreeTraversal.js b/src/renderers/shared/shared/ReactTreeTraversal.js index efe4da50e77a6..d483881530bda 100644 --- a/src/renderers/shared/shared/ReactTreeTraversal.js +++ b/src/renderers/shared/shared/ReactTreeTraversal.js @@ -119,6 +119,10 @@ function traverseEnterLeave(from, to, fn, argFrom, argTo) { if (from === common) { break; } + const alternate = from.alternate; + if (alternate !== null && alternate === common) { + break; + } pathFrom.push(from); from = getParent(from); } @@ -130,6 +134,10 @@ function traverseEnterLeave(from, to, fn, argFrom, argTo) { if (to === common) { break; } + const alternate = to.alternate; + if (alternate !== null && alternate === common) { + break; + } pathTo.push(to); to = getParent(to); }