fix: launch state error

This commit is contained in:
Baptiste Grob
2021-01-22 12:08:48 +01:00
parent a0909399f8
commit afb12f1420

View File

@@ -36,7 +36,7 @@ class ApplicationViewCtrl extends PureViewCtrl<unknown, {
this.$location = $location; this.$location = $location;
this.$rootScope = $rootScope; this.$rootScope = $rootScope;
this.platformString = getPlatformString(); this.platformString = getPlatformString();
this.state = { appClass: '', challenges: [] }; this.state = this.getInitialState();
this.onDragDrop = this.onDragDrop.bind(this); this.onDragDrop = this.onDragDrop.bind(this);
this.onDragOver = this.onDragOver.bind(this); this.onDragOver = this.onDragOver.bind(this);
this.addDragDropHandlers(); this.addDragDropHandlers();
@@ -58,12 +58,20 @@ class ApplicationViewCtrl extends PureViewCtrl<unknown, {
this.loadApplication(); this.loadApplication();
} }
getInitialState() {
return {
appClass: '',
challenges: [],
};
}
async loadApplication() { async loadApplication() {
this.application!.componentManager!.setDesktopManager( this.application!.componentManager!.setDesktopManager(
this.application!.getDesktopService() this.application!.getDesktopService()
); );
await this.application!.prepareForLaunch({ await this.application!.prepareForLaunch({
receiveChallenge: async (challenge) => { receiveChallenge: async (challenge) => {
this.setState({ this.setState({
challenges: this.state.challenges.concat(challenge) challenges: this.state.challenges.concat(challenge)
}); });