From 028c07f89ca7e81b9af9afda44b58fd812f7dbf7 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Wed, 7 Aug 2019 14:48:30 +0100 Subject: [PATCH] Ensure Fundamental flags are added to more locations (#16311) --- packages/react-reconciler/src/ReactFiberCommitWork.js | 4 ++-- packages/react-reconciler/src/ReactFiberCompleteWork.js | 2 +- packages/react-reconciler/src/ReactFiberTreeReflection.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index ee20c789b94fd..e75ed5488e33b 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -1043,7 +1043,7 @@ function commitPlacement(finishedWork: Fiber): void { let node: Fiber = finishedWork; while (true) { const isHost = node.tag === HostComponent || node.tag === HostText; - if (isHost || node.tag === FundamentalComponent) { + if (isHost || (enableFundamentalAPI && node.tag === FundamentalComponent)) { const stateNode = isHost ? node.stateNode : node.stateNode.instance; if (before) { if (isContainer) { @@ -1144,7 +1144,7 @@ function unmountHostComponents(current, renderPriorityLevel): void { ); } // Don't visit children because we already visited them. - } else if (node.tag === FundamentalComponent) { + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { const fundamentalNode = node.stateNode.instance; commitNestedUnmounts(node, renderPriorityLevel); // After all the children have unmounted, it is now safe to remove the diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.js b/packages/react-reconciler/src/ReactFiberCompleteWork.js index d77db8557aee8..aee20f6fc67b2 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.js @@ -168,7 +168,7 @@ if (supportsMutation) { while (node !== null) { if (node.tag === HostComponent || node.tag === HostText) { appendInitialChild(parent, node.stateNode); - } else if (node.tag === FundamentalComponent) { + } else if (enableFundamentalAPI && node.tag === FundamentalComponent) { appendInitialChild(parent, node.stateNode.instance); } else if (node.tag === HostPortal) { // If we have a portal child, then we don't want to traverse diff --git a/packages/react-reconciler/src/ReactFiberTreeReflection.js b/packages/react-reconciler/src/ReactFiberTreeReflection.js index abcb1f36776b4..c10762f05151c 100644 --- a/packages/react-reconciler/src/ReactFiberTreeReflection.js +++ b/packages/react-reconciler/src/ReactFiberTreeReflection.js @@ -24,6 +24,7 @@ import { FundamentalComponent, } from 'shared/ReactWorkTags'; import {NoEffect, Placement} from 'shared/ReactSideEffectTags'; +import {enableFundamentalAPI} from 'shared/ReactFeatureFlags'; const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; @@ -281,7 +282,7 @@ export function findCurrentHostFiberWithNoPortals(parent: Fiber): Fiber | null { if ( node.tag === HostComponent || node.tag === HostText || - node.tag === FundamentalComponent + (enableFundamentalAPI && node.tag === FundamentalComponent) ) { return node; } else if (node.child && node.tag !== HostPortal) {