Skip to content

Commit 2a3ac04

Browse files
gaearonfacebook-github-bot
authored andcommitted
Tweak messages and fix the warning condition
Summary: Two changes: 1. If you're connected at startup, and then disconnect, we're supposed to show a yellow box. Looks like we weren't doing it for a few days because the field we were checking has turned into a method. 2. I changed the wording back to remove "Metro" since the packager may be Haul, for example. So I'm just calling it "development server". Does that seem reasonable? I also removed mentions of Fast Refresh since it's not actually relevant to the problem. Reviewed By: cpojer Differential Revision: D16459080 fbshipit-source-id: c9c1f19718d522c745e4107a3e7e3a6c63f82642
1 parent 8a80d61 commit 2a3ac04

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Libraries/Utilities/HMRClient.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ const HMRClient: HMRClientNativeInterface = {
143143
);
144144

145145
client.on('connection-error', e => {
146-
let error = `Fast Refresh isn't working because it cannot connect to the development server.
146+
let error = `Cannot connect to the Metro server.
147147
148148
Try the following to fix the issue:
149-
- Ensure that the Metro Server is running and available on the same network`;
149+
- Ensure that the Metro server is running and available on the same network`;
150150

151151
if (Platform.OS === 'ios') {
152152
error += `
@@ -190,12 +190,12 @@ Error: ${e.message}`;
190190
if (data.type === 'GraphNotFoundError') {
191191
client.close();
192192
setHMRUnavailableReason(
193-
'The Metro server has restarted since the last edit. Fast Refresh will be disabled until you reload the application.',
193+
'The Metro server has restarted since the last edit. Reload to reconnect.',
194194
);
195195
} else if (data.type === 'RevisionNotFoundError') {
196196
client.close();
197197
setHMRUnavailableReason(
198-
'The Metro server and the client are out of sync. Fast Refresh will be disabled until you reload the application.',
198+
'The Metro server and the client are out of sync. Reload to reconnect.',
199199
);
200200
} else {
201201
currentCompileErrorMessage = `${data.type} ${data.message}`;
@@ -208,7 +208,7 @@ Error: ${e.message}`;
208208
client.on('close', data => {
209209
LoadingView.hide();
210210
setHMRUnavailableReason(
211-
'Disconnected from the Metro server. Fast Refresh will be disabled until you reload the application.',
211+
'Disconnected from the Metro server. Reload to reconnect.',
212212
);
213213
});
214214

@@ -229,7 +229,7 @@ function setHMRUnavailableReason(reason) {
229229
return;
230230
}
231231
hmrUnavailableReason = reason;
232-
if (hmrClient.shouldApplyUpdates) {
232+
if (hmrClient.isEnabled()) {
233233
// If HMR is currently enabled, show a warning.
234234
console.warn(reason);
235235
// (Not using the `warning` module to prevent a Buck cycle.)

0 commit comments

Comments
 (0)