Skip to content

Commit 2160190

Browse files
committed
fix: execute checkForChanges before syncing changed files
1 parent 317f10b commit 2160190

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/controllers/run-controller.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class RunController extends EventEmitter implements IRunController {
2525
private $prepareController: IPrepareController,
2626
private $prepareDataService: IPrepareDataService,
2727
private $prepareNativePlatformService: IPrepareNativePlatformService,
28+
private $projectChangesService: IProjectChangesService,
2829
protected $projectDataService: IProjectDataService
2930
) {
3031
super();
@@ -48,7 +49,18 @@ export class RunController extends EventEmitter implements IRunController {
4849
}
4950

5051
if (!this.prepareReadyEventHandler) {
51-
this.prepareReadyEventHandler = async (data: any) => await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
52+
this.prepareReadyEventHandler = async (data: IFilesChangeEventData) => {
53+
if (data.hasNativeChanges) {
54+
const platformData = this.$platformsDataService.getPlatformData(data.platform, projectData);
55+
const prepareData = this.$prepareDataService.getPrepareData(liveSyncInfo.projectDir, data.platform, { ...liveSyncInfo, watch: !liveSyncInfo.skipWatcher });
56+
const changesInfo = await this.$projectChangesService.checkForChanges(platformData, projectData, prepareData);
57+
if (changesInfo.hasChanges) {
58+
await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
59+
}
60+
} else {
61+
await this.syncChangedDataOnDevices(data, projectData, liveSyncInfo);
62+
}
63+
};
5264
this.$prepareController.on(PREPARE_READY_EVENT_NAME, this.prepareReadyEventHandler.bind(this));
5365
}
5466

0 commit comments

Comments
 (0)