Browse Source

Fix loading in New state.

pull/387/head
Sebastian Stehle 7 years ago
parent
commit
d15fb0c265
  1. 2
      src/Squidex/app/features/content/pages/content/content-page.component.ts
  2. 10
      src/Squidex/app/shared/state/contents.state.ts

2
src/Squidex/app/features/content/pages/content/content-page.component.ts

@ -78,6 +78,8 @@ export class ContentPageComponent extends ResourceOwner implements CanComponentD
}
public ngOnInit() {
this.contentsState.loadIfNotLoaded();
this.own(
this.languagesState.languages
.subscribe(languages => {

10
src/Squidex/app/shared/state/contents.state.ts

@ -6,7 +6,7 @@
*/
import { Injectable } from '@angular/core';
import { forkJoin, Observable, of } from 'rxjs';
import { forkJoin, Observable, of, empty } from 'rxjs';
import { catchError, switchMap, tap } from 'rxjs/operators';
import {
@ -124,6 +124,14 @@ export abstract class ContentsStateBase extends State<Snapshot> {
return this.loadInternal(isReload);
}
public loadIfNotLoaded(): Observable<any> {
if (this.snapshot.isLoaded) {
return empty();
}
return this.loadInternal(false);
}
private loadInternal(isReload = false) {
return this.loadInternalCore(isReload).pipe(shareSubscribed(this.dialogs));
}

Loading…
Cancel
Save