Skip to content

Commit

Permalink
Do not send 'hot' parameter when requesting a bundle from iOS
Browse files Browse the repository at this point in the history
Reviewed By: fromcelticpark

Differential Revision: D5631050

fbshipit-source-id: 1f587f3af68da4d94b5d24afabf7659abb697747
  • Loading branch information
rafeca authored and facebook-github-bot committed Aug 16, 2017
1 parent aaae99e commit 6ad7e82
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
3 changes: 2 additions & 1 deletion React/Base/RCTBatchedBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#import "RCTPerformanceLogger.h"
#import "RCTUtils.h"

#import <React/RCTDevSettings.h>
#import <React/RCTProfile.h>
#import <React/RCTRedBox.h>

Expand Down Expand Up @@ -549,7 +550,7 @@ - (void)executeSourceCode:(NSData *)sourceCode
}];

#if RCT_DEV
if ([RCTGetURLQueryParam(self.bundleURL, @"hot") boolValue]) {
if (_parentBridge.devSettings.isHotLoadingEnabled) {
NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash
NSString *host = self.bundleURL.host;
NSNumber *port = self.bundleURL.port;
Expand Down
2 changes: 1 addition & 1 deletion React/CxxBridge/RCTCxxBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
}

#if RCT_DEV
if ([RCTGetURLQueryParam(self.bundleURL, @"hot") boolValue]) {
if (self.devSettings.isHotLoadingEnabled) {
NSString *path = [self.bundleURL.path substringFromIndex:1]; // strip initial slash
NSString *host = self.bundleURL.host;
NSNumber *port = self.bundleURL.port;
Expand Down
17 changes: 4 additions & 13 deletions React/Modules/RCTDevSettings.mm
Original file line number Diff line number Diff line change
Expand Up @@ -316,25 +316,17 @@ - (void)_liveReloadSettingDidChange

RCT_EXPORT_METHOD(setHotLoadingEnabled:(BOOL)enabled)
{
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingHotLoadingEnabled];
[self _hotLoadingSettingDidChange];
if (self.isHotLoadingEnabled != enabled) {
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingHotLoadingEnabled];
[_bridge reload];
}
}

- (BOOL)isHotLoadingEnabled
{
return [[self settingForKey:kRCTDevSettingHotLoadingEnabled] boolValue];
}

- (void)_hotLoadingSettingDidChange
{
BOOL hotLoadingEnabled = self.isHotLoadingAvailable && self.isHotLoadingEnabled;
if (RCTGetURLQueryParam(_bridge.bundleURL, @"hot").boolValue != hotLoadingEnabled) {
_bridge.bundleURL = RCTURLByReplacingQueryParam(_bridge.bundleURL, @"hot",
hotLoadingEnabled ? @"true" : nil);
[_bridge reload];
}
}

RCT_EXPORT_METHOD(toggleElementInspector)
{
BOOL value = [[self settingForKey:kRCTDevSettingIsInspectorShown] boolValue];
Expand Down Expand Up @@ -439,7 +431,6 @@ - (void)_configurePackagerConnection
*/
- (void)_synchronizeAllSettings
{
[self _hotLoadingSettingDidChange];
[self _liveReloadSettingDidChange];
[self _remoteDebugSettingDidChange];
[self _profilingSettingDidChange];
Expand Down

0 comments on commit 6ad7e82

Please sign in to comment.