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

[HMR] Improve Hot Loading gating #5339

Closed
martinbigio opened this issue Jan 15, 2016 · 18 comments
Closed

[HMR] Improve Hot Loading gating #5339

martinbigio opened this issue Jan 15, 2016 · 18 comments
Assignees
Labels
Help Wanted :octocat: Issues ideal for external contributors. Resolution: Locked This issue was locked by the bot.

Comments

@martinbigio
Copy link
Contributor

Hot Loading is currently disabled by default until we're confident enough it's good to go. On iOS, users have to enable it by tweaking the method hotLoadingEnabled on RCTDevMenu.m. @satya164 might know about how to enable this on Android.

Ideally the feature should be enabled way easier (i.e.: by implementing a method on AppDelegate.m for instance). I don't know much about Android to make a proposal.

@facebook-github-bot
Copy link
Contributor

Hey martinbigio, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@martinbigio martinbigio changed the title Improve Hot Loading gating [HMR] Improve Hot Loading gating Jan 15, 2016
@satya164
Copy link
Contributor

I'll look into how to do this on Android.

@martinbigio
Copy link
Contributor Author

@javache any pointer on how to enable this on AppDelegate given the current gating code on RCTDevMenu/RCTBridgeDelegate? :)

@javache
Copy link
Member

javache commented Jan 15, 2016

Our default app delegate template (https://github.com/facebook/react-native/blob/master/local-cli/generator-ios/templates/app/AppDelegate.m) doesn't really make use of the bridge's delegate methods. We could change this to create a RCTBridge first, but you'd lose the advantage of the simple RCTRootView API.

Anyone who has a slightly more complicated setup should be able to simply element the new delegate method.

@satya164
Copy link
Contributor

I was thinking, on Android, we can have the following to enable experimental features,

protected List<Integer> getEnabledExperiments() {
    return Array<Integer>.asList(
        Experiments.HOT_MODULE_REPLACEMENT,
        Experiments.SOME_OTHER_CRAZY_EXPERIMENT);
}

Or simpler, call Experiments.setEnabledExperiments anywhere,

Experiments.setEnabledExperiments(
    Array<Integer>.asList(
        Experiments.HOT_MODULE_REPLACEMENT,
        Experiments.SOME_OTHER_CRAZY_EXPERIMENT));

Then in the code which implements the experiment, we can do the following,

if (Experiments.isExperimentEnabled(Experiments.HOT_MODULE_REPLACEMENT)) {
    // Do stuff
}

What do you think about the approach before I implement it?

@satya164
Copy link
Contributor

cc @mkonicek

@satya164
Copy link
Contributor

So another approach would be to allow people enable experiments from dev settings UI as @mkonicek suggested.

@satya164
Copy link
Contributor

I'm not sure about having it in the UI, because it's very easy to find and enable, and then we can get bug reports even if it's not ready. Adding it only in code means that only people who know what they are doing enable experimental things, and we get better quality bug reports.

@martinbigio
Copy link
Contributor Author

Yeah, that makes sense

@mkonicek
Copy link
Contributor

@martinbigio When I start the packager in a new RN app I see it listens on "/hot" by default. Is that intentional?

screen shot 2016-01-21 at 12 46 50 pm

@satya164
Copy link
Contributor

@mkonicek It'll only work when the url has hot=true. By default it's hot=false in Android. In iOS it seems to be turned on by default.

@mkonicek
Copy link
Contributor

Cool, that makes sense. Don't think it should be enabled by default on iOS though, should it?

@satya164
Copy link
Contributor

@mkonicek Yes, it shouldn't. @martinbigio can confirm :)

@martinbigio
Copy link
Contributor Author

The feature is disabled but if a user would modify RCTDevMenu to return YES on hotLoadingAvailable, the feature will not only become visible on the menu but enabled by default. Will fix that today

@JohnyDays
Copy link
Contributor

Hey, is there any guidelines on testing the feature for android? I'd love to give some feedback on it, but can't seem to figure out how to enable it.
People in e018aa3 seem to be asking for it as well. Cheers 👍

@satya164
Copy link
Contributor

@JohnyDays For now you can install from master. There will be an option to enable it in the dev menu.

@jsierles
Copy link
Contributor

Now HMR is enabled in 0.22.0, is this issue still relevant?

@satya164
Copy link
Contributor

No, let's close it.

@ide ide closed this as completed Mar 20, 2016
@hramos hramos added Help Wanted :octocat: Issues ideal for external contributors. and removed Help Wanted :octocat: Issues ideal for external contributors. labels Mar 8, 2018
@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Help Wanted :octocat: Issues ideal for external contributors. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

10 participants