Skip to content

Commit b04ff39

Browse files
authored
Merge pull request #4847 from NativeScript/fatme/fix-multiple-livesync-sidekick
fix: stop all webpack processes from sidekick when stopping the livesync
2 parents ca1d334 + c575d50 commit b04ff39

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

lib/controllers/run-controller.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ export class RunController extends EventEmitter implements IRunController {
3838
const projectData = this.$projectDataService.getProjectData(projectDir);
3939
await this.initializeSetup(projectData);
4040

41-
const platforms = this.$devicesService.getPlatformsFromDeviceDescriptors(deviceDescriptors);
4241
const deviceDescriptorsForInitialSync = this.getDeviceDescriptorsForInitialSync(projectDir, deviceDescriptors);
42+
const newPlatforms = this.$devicesService.getPlatformsFromDeviceDescriptors(deviceDescriptors);
43+
const oldPlatforms = this.$liveSyncProcessDataService.getPlatforms(projectDir);
44+
const platforms = _.uniq(_.concat(newPlatforms, oldPlatforms));
4345

4446
this.$liveSyncProcessDataService.persistData(projectDir, deviceDescriptors, platforms);
4547

lib/definitions/livesync.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -492,5 +492,6 @@ declare global {
492492
getAllPersistedData(): IDictionary<ILiveSyncProcessData>;
493493
persistData(projectDir: string, deviceDescriptors: ILiveSyncDeviceDescriptor[], platforms: string[]): void;
494494
hasDeviceDescriptors(projectDir: string): boolean;
495+
getPlatforms(projectDir: string): string[];
495496
}
496497
}

lib/services/livesync-process-data-service.ts

+6
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,11 @@ export class LiveSyncProcessDataService implements ILiveSyncProcessDataService {
3030
public getAllPersistedData() {
3131
return this.processes;
3232
}
33+
34+
public getPlatforms(projectDir: string): string[] {
35+
const liveSyncProcessesInfo = this.processes[projectDir] || <ILiveSyncProcessData>{};
36+
const currentPlatforms = liveSyncProcessesInfo.platforms;
37+
return currentPlatforms || [];
38+
}
3339
}
3440
$injector.register("liveSyncProcessDataService", LiveSyncProcessDataService);

0 commit comments

Comments
 (0)