From de6aa10bdd05d7195a9fceeb884904df4b85cbd8 Mon Sep 17 00:00:00 2001 From: Emily Janzer Date: Wed, 4 Dec 2019 10:44:54 -0800 Subject: [PATCH] Use registerLazyCallableModule to register HMRClient Summary: Right now we use `BatchedBridge.registerLazyCallableModule` for all JS modules except for `HMRClient`, which uses `registerCallableModule` instead (takes the module itself instead of a function that returns it). I'm standardizing on `registerLazyCallableModule` so that it will be easier to swap out the implementation later for bridgeless mode. The only reason I could think why we wouldn't want to do this is if we're relying on some side effect of `require('HMRClient')` when setting up JS, but there don't seem to be any side effects in that module that I can see. Changelog: [Internal] Reviewed By: rickhanlonii Differential Revision: D18798870 fbshipit-source-id: a5c950bdbfd998bb12e4843ee28ece08a26c84bf --- Libraries/Core/setUpBatchedBridge.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Libraries/Core/setUpBatchedBridge.js b/Libraries/Core/setUpBatchedBridge.js index 57f05b2539..8f6db0ec2f 100644 --- a/Libraries/Core/setUpBatchedBridge.js +++ b/Libraries/Core/setUpBatchedBridge.js @@ -50,13 +50,11 @@ if (!global.RN$Bridgeless) { ); if (__DEV__ && !global.__RCTProfileIsProfiling) { - BatchedBridge.registerCallableModule( - 'HMRClient', + BatchedBridge.registerLazyCallableModule('HMRClient', () => require('../Utilities/HMRClient'), ); } else { - BatchedBridge.registerCallableModule( - 'HMRClient', + BatchedBridge.registerLazyCallableModule('HMRClient', () => require('../Utilities/HMRClientProdShim'), ); }