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

improve dev mode and HMR interop #24377

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public boolean isJSDevModeEnabled() {
return mPreferences.getBoolean(PREFS_JS_DEV_MODE_DEBUG_KEY, true);
}

public void setJSDevModeEnabled(boolean value) {
mPreferences.edit().putBoolean(PREFS_JS_DEV_MODE_DEBUG_KEY, value).apply();
}

@Override
public boolean isJSMinifyEnabled() {
return mPreferences.getBoolean(PREFS_JS_MINIFY_DEBUG_KEY, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ public void showDevOptionsDialog() {
new DevOptionHandler() {
@Override
public void onOptionSelected() {
if (!mDevSettings.isJSDevModeEnabled() && mDevSettings.isHotModuleReplacementEnabled()) {
Toast.makeText(mApplicationContext, "HMR cannot be enabled when Dev mode is off. Disabling HMR...", Toast.LENGTH_LONG).show();
mDevSettings.setHotModuleReplacementEnabled(false);
}
handleReloadJS();
}
});
Expand Down Expand Up @@ -509,6 +513,10 @@ public void onOptionSelected() {
new DevOptionHandler() {
@Override
public void onOptionSelected() {
if (!mDevSettings.isHotModuleReplacementEnabled() && !mDevSettings.isJSDevModeEnabled()) {
Toast.makeText(mApplicationContext, "You're trying to enable HMR while Dev mode is off. Turning both HMR and the Dev mode on...", Toast.LENGTH_LONG).show();
mDevSettings.setJSDevModeEnabled(true);
}
mDevSettings.setHotModuleReplacementEnabled(!mDevSettings.isHotModuleReplacementEnabled());
handleReloadJS();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<CheckBoxPreference
android:key="js_dev_mode_debug"
android:title="JS Dev Mode"
android:summary="Load JavaScript bundle with __DEV__ = true for easier debugging. Disable for performance testing. Reload for the change to take effect."
android:summary="Load JavaScript bundle with __DEV__ = true for easier debugging. Disable for performance testing. Reload for the change to take effect."
android:defaultValue="true"
/>
<CheckBoxPreference
Expand Down