mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-15 23:51:57 +00:00
Trigger change detection explicitly after WebIDE content is updated
This makes human sized stack traces go away ¯\_(ツ)_/¯
This commit is contained in:
parent
882899ee9c
commit
8e5f402519
@ -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<SourceCode>(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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user