Skip to content

Commit 845e9ea

Browse files
stigifacebook-github-bot
authored andcommitted
Fix for loading state of Fast Refresh from user defaults (#29880)
Summary: Disabling Fast Refresh won't be persisted when restarting the app. I believe this regressed with 824e171. In this commit `HMRClient.setup` will always be called with `enabled` being set true. This PR loads the _enabled_ state from the user defaults (as it was done before). ## Changelog [iOS] [Fixed] - Enable Fast Refresh gets persisted across app launches Pull Request resolved: #29880 Test Plan: Without this change Fast Refresh is enabled on every app restart. Tested with this change: - Disabling Fast Refresh - Restarting App -> Fast Refresh still disabled - Enabled Fast Refresh again - Restarting App -> Fast Refresh still enabled again Reviewed By: sammy-SC Differential Revision: D23686435 Pulled By: PeteTheHeat fbshipit-source-id: 42c31b22060d3dc4b1d4cb8f41792b303fc7fce8
1 parent 9c353b5 commit 845e9ea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

React/CoreModules/RCTDevSettings.mm

+4-3
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,18 @@ - (void)addHandler:(id<RCTPackagerClientMethod>)handler forPackagerMethod:(NSStr
405405

406406
- (void)setupHMRClientWithBundleURL:(NSURL *)bundleURL
407407
{
408-
if (bundleURL && !bundleURL.fileURL) { // isHotLoadingAvailable check
408+
if (bundleURL && !bundleURL.fileURL) {
409409
NSString *const path = [bundleURL.path substringFromIndex:1]; // Strip initial slash.
410410
NSString *const host = bundleURL.host;
411411
NSNumber *const port = bundleURL.port;
412+
BOOL isHotLoadingEnabled = self.isHotLoadingEnabled;
412413
if (self.bridge) {
413414
[self.bridge enqueueJSCall:@"HMRClient"
414415
method:@"setup"
415-
args:@[ @"ios", path, host, RCTNullIfNil(port), @(YES) ]
416+
args:@[ @"ios", path, host, RCTNullIfNil(port), @(isHotLoadingEnabled) ]
416417
completion:NULL];
417418
} else {
418-
self.invokeJS(@"HMRClient", @"setup", @[ @"ios", path, host, RCTNullIfNil(port), @(YES) ]);
419+
self.invokeJS(@"HMRClient", @"setup", @[ @"ios", path, host, RCTNullIfNil(port), @(isHotLoadingEnabled) ]);
419420
}
420421
}
421422
}

0 commit comments

Comments
 (0)