Skip to content

fix: fix "MaxEventListeners detected" error when livesync is started more than 11 times from sidekick #4210

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 2 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/services/livesync/livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
}

public async liveSyncToPreviewApp(data: IPreviewAppLiveSyncData): Promise<IQrCodeImageData> {
this.$previewAppLiveSyncService.on(LiveSyncEvents.previewAppLiveSyncError, liveSyncData => {
this.emit(LiveSyncEvents.previewAppLiveSyncError, liveSyncData);
});
this.attachToPreviewAppLiveSyncError();

await this.liveSync([], {
syncToPreviewApp: true,
Expand Down Expand Up @@ -139,6 +137,13 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
return currentDescriptors || [];
}

@cache()
private attachToPreviewAppLiveSyncError(): void {
this.$previewAppLiveSyncService.on(LiveSyncEvents.previewAppLiveSyncError, liveSyncData => {
this.emit(LiveSyncEvents.previewAppLiveSyncError, liveSyncData);
});
}

private handleWarnings(liveSyncData: ILiveSyncInfo, projectData: IProjectData) {
if (liveSyncData.useHotModuleReload) {
this.$logger.warn("Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398");
Expand Down
6 changes: 3 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"mkdirp": "0.5.1",
"mute-stream": "0.0.5",
"nativescript-doctor": "1.8.1",
"nativescript-preview-sdk": "0.3.1",
"nativescript-preview-sdk": "0.3.2",
"open": "0.0.5",
"ora": "2.0.0",
"osenv": "0.1.3",
Expand Down