mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Do not load JS bundle from local cache if Metro is running
Summary: Having a cached JS bundle being loaded instead of loading it from Metro can cause recent changes made with Fast Refresh not to be picked up after an app is killed and started again. This diff makes a change so that we always download the bundle from Metro if it's running and only if it's not running we check if there is a cached recent bundle. Reviewed By: gaearon, davidaurelio Differential Revision: D16380243 fbshipit-source-id: b2842f718e0c21a3f4ca5ebeb3c2bae1df87a6e1
This commit is contained in:
committed by
Facebook Github Bot
parent
97d3d59077
commit
a1273bb593
@@ -369,15 +369,6 @@ public class ReactInstanceManager {
|
||||
if (mUseDeveloperSupport && mJSMainModulePath != null) {
|
||||
final DeveloperSettings devSettings = mDevSupportManager.getDevSettings();
|
||||
|
||||
// If remote JS debugging is enabled, load from dev server.
|
||||
if (mDevSupportManager.hasUpToDateJSBundleInCache()
|
||||
&& !devSettings.isRemoteJSDebugEnabled()) {
|
||||
// If there is a up-to-date bundle downloaded from server,
|
||||
// with remote JS debugging disabled, always use that.
|
||||
onJSBundleLoadedFromServer(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Systrace.isTracing(TRACE_TAG_REACT_APPS | TRACE_TAG_REACT_JS_VM_CALLS)) {
|
||||
if (mBundleLoader == null) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
@@ -392,6 +383,11 @@ public class ReactInstanceManager {
|
||||
public void run() {
|
||||
if (packagerIsRunning) {
|
||||
mDevSupportManager.handleReloadJS();
|
||||
} else if (mDevSupportManager.hasUpToDateJSBundleInCache()
|
||||
&& !devSettings.isRemoteJSDebugEnabled()) {
|
||||
// If there is a up-to-date bundle downloaded from server,
|
||||
// with remote JS debugging disabled, always use that.
|
||||
onJSBundleLoadedFromServer(null);
|
||||
} else {
|
||||
// If dev server is down, disable the remote JS debugging.
|
||||
devSettings.setRemoteJSDebugEnabled(false);
|
||||
|
||||
Reference in New Issue
Block a user