fixed an issue where a rehydrate would sometimes leave the app in a broken state

This commit is contained in:
Art Lowel
2017-10-26 12:58:42 +02:00
parent 94272b9b99
commit ee84399d23
7 changed files with 41 additions and 36 deletions

View File

@@ -1,6 +1,5 @@
import { Observable } from 'rxjs/Observable';
import { PageInfo } from '../shared/page-info.model';
import { hasValue } from '../../shared/empty.util';
export enum RemoteDataState {
RequestPending = 'RequestPending',
@@ -26,13 +25,13 @@ export class RemoteData<T> {
}
get state(): RemoteDataState {
if (this.isSuccessFul === true) {
if (this.isSuccessFul === true && hasValue(this.payload)) {
return RemoteDataState.Success
} else if (this.isSuccessFul === false) {
return RemoteDataState.Failed
} else if (this.requestPending === true) {
return RemoteDataState.RequestPending
} else if (this.responsePending === true || this.isSuccessFul === undefined) {
} else {
return RemoteDataState.ResponsePending
}
}