Commit 5e2aaa29 authored by Lukas Burgey's avatar Lukas Burgey

Add a check if states are undefined

parent 826c5925
......@@ -89,9 +89,11 @@ export class StateComponent implements OnInit {
this.state$ = this.userService.subscribeStateFor(this.service);
this.state$.subscribe(
(state: DeploymentState) => {
this.button = this.buttons[state.state];
this.stateDescription = this.stateDescriptions[state.state];
(state: DeploymentState | undefined) => {
if (state !== undefined) {
this.button = this.buttons[state.state];
this.stateDescription = this.stateDescriptions[state.state];
}
}
);
}
......
......@@ -442,7 +442,7 @@ export class UserService {
);
}
public subscribeStateFor(service: Service): Observable<DeploymentState> {
public subscribeStateFor(service: Service): Observable<DeploymentState | undefined> {
return this.deploymentStates$.asObservable().pipe(
map((states: DeploymentState[]) => states.find(
(dsi: DeploymentState) => dsi.service.id === service.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment