From 9a7e0beb41f6cec0a85634a23bd92efc2084293b Mon Sep 17 00:00:00 2001 From: Mengdi Chen Date: Mon, 6 Jun 2022 17:25:40 -0400 Subject: [PATCH] use values() instead of for loop --- packages/react-devtools-shared/src/backend/agent.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/react-devtools-shared/src/backend/agent.js b/packages/react-devtools-shared/src/backend/agent.js index e05a43d265b6a..a5e2e9d6914f8 100644 --- a/packages/react-devtools-shared/src/backend/agent.js +++ b/packages/react-devtools-shared/src/backend/agent.js @@ -313,14 +313,10 @@ export default class Agent extends EventEmitter<{| } getIDForNode(node: Object): number | null { - const renderers = []; - for (const rendererID in this._rendererInterfaces) { - const renderer = ((this._rendererInterfaces[ - (rendererID: any) - ]: any): RendererInterface); - renderers.push(renderer); - } - const rendererInterface = getBestMatchingRendererInterface(renderers, node); + const rendererInterface = getBestMatchingRendererInterface( + this._rendererInterfaces.values(), + node, + ); if (rendererInterface != null) { return rendererInterface.getFiberIDForNative(node, true); }