From 292268ea3fa429cd1a1245b6239e0a85b59da02a Mon Sep 17 00:00:00 2001 From: Tomek Zawadzki Date: Tue, 3 Jan 2023 03:07:13 -0800 Subject: [PATCH] Eliminate double call of `shadowNodeFromValue` in `dispatchCommand` (#35695) Summary: This PR slightly improves the implementation of `dispatchCommand` method of `UIManagerBinding` to use existing variable `shadowNode` instead of calling `shadowNodeFromValue` again. ## Changelog [INTERNAL] [CHANGED] - Eliminated double call of `shadowNodeFromValue` in `dispatchCommand` Pull Request resolved: https://github.com/facebook/react-native/pull/35695 Test Plan: Launch RNTester with Fabric enabled and check if `scrollTo` or some other command works properly. Reviewed By: christophpurrer Differential Revision: D42233216 Pulled By: robhogan fbshipit-source-id: db152206060ff599962f47c43fda8ea797f2a8cb --- ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index 5bff9f775dd..9165073adf3 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -493,7 +493,7 @@ jsi::Value UIManagerBinding::get( auto shadowNode = shadowNodeFromValue(runtime, arguments[0]); if (shadowNode) { uiManager->dispatchCommand( - shadowNodeFromValue(runtime, arguments[0]), + shadowNode, stringFromValue(runtime, arguments[1]), commandArgsFromValue(runtime, arguments[2])); }