[react-interactions] Ensure props on scope query function is always object (#17212)

This commit is contained in:
Dominic Gannaway
2019-10-29 13:26:46 -07:00
committed by GitHub
parent 3497ccc149
commit 048879edad
+3 -1
View File
@@ -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));
}
}