From 784eaf6d52d49b70784e7600b6b78fdec62f5afc Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Tue, 29 Oct 2019 20:20:18 +0100 Subject: [PATCH] [react-interactions] Ensure props on scope query function is always object --- packages/react-reconciler/src/ReactFiberScope.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-reconciler/src/ReactFiberScope.js b/packages/react-reconciler/src/ReactFiberScope.js index 1b33b78cadfa4..34eb261f24d2e 100644 --- a/packages/react-reconciler/src/ReactFiberScope.js +++ b/packages/react-reconciler/src/ReactFiberScope.js @@ -31,6 +31,8 @@ function getSuspenseFallbackChild(fiber: Fiber): Fiber | null { return ((((fiber.child: any): Fiber).sibling: any): Fiber).child; } +const emptyObject = {}; + function collectScopedNodes( node: Fiber, fn: (type: string | Object, props: Object) => boolean, @@ -39,7 +41,7 @@ function collectScopedNodes( if (enableScopeAPI) { if (node.tag === HostComponent) { const {type, memoizedProps} = node; - if (fn(type, memoizedProps) === true) { + if (fn(type, memoizedProps || emptyObject) === true) { scopedNodes.push(getPublicInstance(node.stateNode)); } }