Skip to content

Kddimitrov/restart on hmr fail #3980

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

Merged
merged 3 commits into from
Oct 8, 2018
Merged

Conversation

KristianDD
Copy link
Contributor

PR Checklist

What is the current behavior?

When HMR fails to apply patch the application will remain with old content.

What is the new behavior?

When HMR fails to apply patch the application gets updated by regular LS and restarted.

Fixes/Implements/Closes #3892.

@KristianDD KristianDD force-pushed the kddimitrov/restart-on-hmr-fail branch 2 times, most recently from 99642ab to 2e7bc0a Compare October 5, 2018 14:04
@@ -0,0 +1,4 @@
interface IHmrStatusService {
awaitHmrStatus(deviceId: string, operationHash: string): Promise<number>;
Copy link
Contributor

Choose a reason for hiding this comment

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

awaitHmrStatus -> getHmrStatus

const interval = setInterval(() => {
const status = this.getStatusByKey(key);
if (status || retryCount === 0) {
clearInterval(interval);
Copy link
Contributor

Choose a reason for hiding this comment

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

+ clear on dispose


if (data.appFilesUpdaterOptions.useHotModuleReload && currentHmrData.hash) {
const devices = _.filter(this.$previewSdkService.connectedDevices, { platform: platform.toLowerCase() });
_.forEach(devices, async (previewDevice: Device) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

await properly here

}

private processDeviceLogResponse(message: string, deviceIdentifier: string) {
const device = this.$devicesService.getDeviceByIdentifier(deviceIdentifier);
const devicePlatform = device.deviceInfo.platform.toLowerCase();
const devicePlatform = this.tryGetPlatform(deviceIdentifier);
Copy link
Contributor

Choose a reason for hiding this comment

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

check the performance implications here (we will get the device or catch an exception for each log)

const status = await this.$hmrStatusService.awaitHmrStatus(previewDevice.id, currentHmrData.hash);
if (status === HmrConstants.HMR_ERROR_STATUS) {
await this.applyChanges(platformData, projectData, currentHmrData.fallbackFiles[platform], false);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

boolean variable passed as argument 🙀 🙀 🙀

await this.applyChanges(platformData, projectData, currentHmrData.fallbackFiles[platform], { useHotModuleReload: false });

@KristianDD KristianDD force-pushed the kddimitrov/restart-on-hmr-fail branch 2 times, most recently from a8f42a5 to 0c5b380 Compare October 8, 2018 15:32
@KristianDD KristianDD force-pushed the kddimitrov/restart-on-hmr-fail branch from 0c5b380 to 4e94cb1 Compare October 8, 2018 16:04
@KristianDD KristianDD merged commit 5f6243b into master Oct 8, 2018
@KristianDD KristianDD deleted the kddimitrov/restart-on-hmr-fail branch October 8, 2018 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants