From b2d6ea00c8ac5438de29e0bcdc384a0f8526a2bd Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Wed, 13 May 2020 17:05:04 +0200 Subject: [PATCH] fix: initialize controller state softly --- .../javascripts/views/abstract/pure_view_ctrl.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/views/abstract/pure_view_ctrl.ts b/app/assets/javascripts/views/abstract/pure_view_ctrl.ts index 086a52709..495e2ba3b 100644 --- a/app/assets/javascripts/views/abstract/pure_view_ctrl.ts +++ b/app/assets/javascripts/views/abstract/pure_view_ctrl.ts @@ -17,13 +17,13 @@ export class PureViewCtrl { /* @ngInject */ constructor($timeout: ng.ITimeoutService) { this.$timeout = $timeout; - /* Allow caller constructor to finish setting instance variables */ - setImmediate(() => { - this.state = this.getInitialState(); - }); } $onInit() { + this.state = { + ...this.getInitialState(), + ...this.state, + } this.addAppEventObserver(); this.addAppStateObserver(); } @@ -141,4 +141,4 @@ export class PureViewCtrl { /** Optional override */ } -} \ No newline at end of file +}