From 8e5f402519a1ace36e7b3c838806f2c3501656a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Bokros?= Date: Thu, 15 Feb 2018 11:21:14 +0100 Subject: [PATCH] Trigger change detection explicitly after WebIDE content is updated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes human sized stack traces go away ¯\_(ツ)_/¯ --- src/app/webide/webide.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts index d3bd3c1..b22d119 100644 --- a/src/app/webide/webide.component.ts +++ b/src/app/webide/webide.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; import 'brace/mode/python'; import 'brace/mode/javascript'; @@ -22,7 +22,8 @@ export class WebideComponent implements OnInit { files: string[]; saveButtonState = 'DIRTY'; - constructor(private webSocketService: WebSocketService) { } + constructor(private webSocketService: WebSocketService, + private changeDetectorRef: ChangeDetectorRef) { } ngOnInit() { this.webSocketService.observeAnchor(this.anchor_id).subscribe((event) => { @@ -33,6 +34,8 @@ export class WebideComponent implements OnInit { if (event.data.command === 'write') { this.saveButtonState = 'SAVED'; } if (event.data.command === 'reload') { this.requestCode(); } + + this.changeDetectorRef.detectChanges(); }); this.requestCode(); }