mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Register the bundle regardless of whether Fast Refresh is on
Summary: We want to move to a world where Fast Refresh is on by default. As a first step, we can register the bundle early. This means we'll start receiving hot updates via the socket even if Fast Refresh is off. We'll just be ignoring those. Anecdotally people with Fast Refresh on have had good experience even with invasive changes like branch switches. So this seems like a good way to test the waters further. It's also a prerequisite to unlocking a nicer experience where you can turn it on anytime and "catch up" on the changes you've missed. (That's out of scope of this diff.) Reviewed By: cpojer Differential Revision: D16344019 fbshipit-source-id: 6e5f8278909810b32c80e0af010251c876e4313b
This commit is contained in:
committed by
Facebook Github Bot
parent
295affc8ab
commit
e6d32d8a49
@@ -53,6 +53,10 @@ const HMRClient: HMRClientNativeInterface = {
|
||||
invariant(hmrClient, 'Expected HMRClient.setup() call at startup.');
|
||||
hmrClient.shouldApplyUpdates = true;
|
||||
|
||||
// We use this for internal logging only.
|
||||
// It doesn't affect the logic.
|
||||
hmrClient.send(JSON.stringify({type: 'log-opt-in'}));
|
||||
|
||||
// Intentionally reading it outside the condition
|
||||
// so that it's less likely we'd break it later.
|
||||
const modules = (require: any).getModules();
|
||||
@@ -73,8 +77,6 @@ const HMRClient: HMRClientNativeInterface = {
|
||||
// Don't warn about the same modules twice.
|
||||
hmrClient.outdatedModules.clear();
|
||||
}
|
||||
|
||||
registerBundleEntryPoints(hmrClient);
|
||||
},
|
||||
|
||||
disable() {
|
||||
@@ -223,6 +225,8 @@ Error: ${e.message}`;
|
||||
} else {
|
||||
HMRClient.disable();
|
||||
}
|
||||
|
||||
registerBundleEntryPoints(hmrClient);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user