Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Fix for loading state of Fast Refresh from user defaults #29880

Closed
wants to merge 1 commit into from

Conversation

stigi
Copy link
Contributor

@stigi stigi commented Sep 7, 2020

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

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 7, 2020
@stigi stigi changed the title [iOS] Respecting user defaults when setting up HMRClient [iOS] Fix for loading state of Fast Refresh from user defaults Sep 7, 2020
@react-native-bot react-native-bot added Bug Platform: iOS iOS applications. labels Sep 7, 2020
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,209,453 0
android hermes armeabi-v7a 6,858,625 0
android hermes x86 7,644,089 0
android hermes x86_64 7,535,033 0
android jsc arm64-v8a 9,369,050 0
android jsc armeabi-v7a 9,010,350 0
android jsc x86 9,231,770 0
android jsc x86_64 9,808,922 0

Base commit: 902611f

@@ -405,17 +405,18 @@ - (void)addHandler:(id<RCTPackagerClientMethod>)handler forPackagerMethod:(NSStr

- (void)setupHMRClientWithBundleURL:(NSURL *)bundleURL
{
if (bundleURL && !bundleURL.fileURL) { // isHotLoadingAvailable check
Copy link
Contributor Author

@stigi stigi Sep 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this comment was a TODO that's now done
✌️ @PeteTheHeat

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 902611f

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PeteTheHeat has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

if (self.bridge) {
[self.bridge enqueueJSCall:@"HMRClient"
method:@"setup"
args:@[ @"ios", path, host, RCTNullIfNil(port), @(YES) ]
args:@[ @"ios", path, host, RCTNullIfNil(port), @(isHotLoadingEnabled) ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh nice catch. I think I must've originally misread this as isHotLoadingAvailable, and assumed that since we've already passed the if condition, this is always true.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @stigi in 845e9ea.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 15, 2020
jpthomson pushed a commit to Project-J/react-native that referenced this pull request Oct 19, 2020
)

Summary:
Disabling Fast Refresh won't be persisted when restarting the app.

I believe this regressed with facebook@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: facebook#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants