Skip to content

Commit ecd09c7

Browse files
author
Dimitar Kerezov
committed
Fix simultaneous livesync error
1 parent ff5d1e5 commit ecd09c7

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/services/livesync/platform-livesync-service-base.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export abstract class PlatformLiveSyncServiceBase {
6464
const mappedFiles = _.map(filesToSync, filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData));
6565

6666
// Some plugins modify platforms dir on afterPrepare (check nativescript-dev-sass) - we want to sync only existing file.
67-
const existingFiles = mappedFiles.filter(m => this.$fs.exists(m));
67+
const existingFiles = mappedFiles.filter(m => m && this.$fs.exists(m));
6868
this.$logger.trace("Will execute livesync for files: ", existingFiles);
6969
const skippedFiles = _.difference(mappedFiles, existingFiles);
7070
if (skippedFiles.length) {
@@ -75,7 +75,7 @@ export abstract class PlatformLiveSyncServiceBase {
7575
const platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData);
7676
const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, APP_FOLDER_NAME);
7777
const localToDevicePaths = await this.$projectFilesManager.createLocalToDevicePaths(deviceAppData,
78-
projectFilesPath, mappedFiles, []);
78+
projectFilesPath, existingFiles, []);
7979
modifiedLocalToDevicePaths.push(...localToDevicePaths);
8080
await this.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, false);
8181
}
@@ -85,7 +85,10 @@ export abstract class PlatformLiveSyncServiceBase {
8585
const filePaths = liveSyncInfo.filesToRemove;
8686
const platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData);
8787

88-
const mappedFiles = _.map(filePaths, filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData));
88+
const mappedFiles = _(filePaths)
89+
.map(filePath => this.$projectFilesProvider.mapFilePath(filePath, device.deviceInfo.platform, projectData))
90+
.filter(filePath => !!filePath)
91+
.value();
8992
const projectFilesPath = path.join(platformData.appDestinationDirectoryPath, APP_FOLDER_NAME);
9093
const localToDevicePaths = await this.$projectFilesManager.createLocalToDevicePaths(deviceAppData, projectFilesPath, mappedFiles, []);
9194
modifiedLocalToDevicePaths.push(...localToDevicePaths);

0 commit comments

Comments
 (0)