From e534fe036f5c4cdc833a03440eb5d80817d0f2c8 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Wed, 26 Jun 2019 19:26:03 +0300 Subject: [PATCH] fix: hmr is working slowly In recent changes we've broken HMR - in order to get its status on device, we need to call refresh application and monitor the logs. However, the logic at the moment is - wait for logs and call refresh application after that. This leads to very slow hmr. Also this way application will not be restarted when the HMR fails as we do not monitor the logs at the point when the hmr cannot be applied. --- lib/controllers/run-controller.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/controllers/run-controller.ts b/lib/controllers/run-controller.ts index 1351084f8b..1140bccee5 100644 --- a/lib/controllers/run-controller.ts +++ b/lib/controllers/run-controller.ts @@ -358,6 +358,7 @@ export class RunController extends EventEmitter implements IRunController { } let liveSyncResultInfo = await platformLiveSyncService.liveSyncWatchAction(device, watchInfo); + await this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor); if (!liveSyncResultInfo.didRecover && isInHMRMode) { const status = await this.$hmrStatusService.getHmrStatus(device.deviceInfo.identifier, data.hmrData.hash); @@ -369,8 +370,6 @@ export class RunController extends EventEmitter implements IRunController { await this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor); } } - - await this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor); } this.$logger.info(`Successfully synced application ${deviceAppData.appIdentifier} on device ${device.deviceInfo.identifier}.`);