From 93aab84699a34d36aef81b6cfe3c559bcb8bd54c Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 17 Jul 2019 06:17:21 -0700 Subject: [PATCH] Remove the escape hatch Summary: I originally added `forceFullRefresh` as an escape hatch in case Fast Refresh is too unreliable. In practice we haven't seen any major issues with it. Since this option is already very obscure, I'm just removing it. Reviewed By: shergin Differential Revision: D16286632 fbshipit-source-id: c3dc44cffd459912e194e273acf868f3380c64cc --- Libraries/Core/setUpReactRefresh.js | 13 +------------ Libraries/Utilities/HMRClient.js | 5 +---- React/DevSupport/RCTDevMenu.m | 9 --------- .../react/devsupport/DevSupportManagerImpl.java | 10 ---------- 4 files changed, 2 insertions(+), 35 deletions(-) diff --git a/Libraries/Core/setUpReactRefresh.js b/Libraries/Core/setUpReactRefresh.js index b723c5c1414..463123ee822 100644 --- a/Libraries/Core/setUpReactRefresh.js +++ b/Libraries/Core/setUpReactRefresh.js @@ -22,11 +22,6 @@ if (__DEV__) { ReactRefreshRuntime.injectIntoGlobalHook(global); const Refresh = { - // This can be set from the app as a workaround - // if you really want a full reload on every change: - // if (__DEV__) require.Refresh.forceFullRefresh = true; - forceFullRefresh: false, - performFullRefresh() { NativeDevSettings.reload(); }, @@ -40,13 +35,7 @@ if (__DEV__) { register: ReactRefreshRuntime.register, - performReactRefresh() { - if (Refresh.forceFullRefresh) { - NativeDevSettings.reload(); - } else { - ReactRefreshRuntime.performReactRefresh(); - } - }, + performReactRefresh: ReactRefreshRuntime.performReactRefresh, }; (require: any).Refresh = Refresh; diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index f50daab4d6a..1acd228eb3d 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -148,10 +148,7 @@ Error: ${e.message}`; // Until we get "connection-done", messages aren't real edits. didFinishInitialUpdate && // If HMR is disabled by the user, we're ignoring updates. - client.shouldApplyUpdates && - // If full refresh is forced, there's no need to flash the indicator. - // It will be refreshed in a few milliseconds anyway. - !(require: any).Refresh.forceFullRefresh + client.shouldApplyUpdates ); } diff --git a/React/DevSupport/RCTDevMenu.m b/React/DevSupport/RCTDevMenu.m index 6a653b8a552..4b7e9fcaede 100644 --- a/React/DevSupport/RCTDevMenu.m +++ b/React/DevSupport/RCTDevMenu.m @@ -286,17 +286,8 @@ RCT_EXPORT_MODULE() devSettings.isProfilingEnabled = !devSettings.isProfilingEnabled; } }]]; - // "Live reload" which refreshes on every edit was removed in favor of "Fast Refresh". // While native code for "Live reload" is still there, please don't add the option back. - // - // If for some reason you really need a full reload on every edit, - // you can put this into your application entry point as an escape hatch: - // - // if (__DEV__) { - // require.Refresh.forceFullRefresh = true; - // } - // // See D15958697 for more context. } diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java index fcbddf92e46..07d88559218 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java @@ -507,19 +507,9 @@ public class DevSupportManagerImpl mReactInstanceManagerHelper.toggleElementInspector(); } }); - // "Live reload" which refreshes on every edit was removed in favor of "Fast Refresh". // While native code for "Live reload" is still there, please don't add the option back. - // - // If for some reason you really need a full reload on every edit, - // you can put this into your application entry point as an escape hatch: - // - // if (__DEV__) { - // require.Refresh.forceFullRefresh = true; - // } - // // See D15958697 for more context. - options.put( mDevSettings.isHotModuleReplacementEnabled() ? mApplicationContext.getString(R.string.catalyst_hot_reloading_stop)