Browse Source

Unload schemas when app is changed.

pull/282/head
Sebastian 9 years ago
parent
commit
3b73185071
  1. 7
      src/Squidex/app/shared/state/schemas.state.ts

7
src/Squidex/app/shared/state/schemas.state.ts

@ -142,6 +142,7 @@ export class AddFieldForm extends Form<FormGroup> {
}
interface Snapshot {
schemasApp?: string;
schemas: ImmutableArray<SchemaDto>;
isLoaded?: boolean;
@ -198,12 +199,16 @@ export class SchemasState extends State<Snapshot> {
}
public load(): Observable<any> {
if (this.snapshot.schemasApp !== this.appName) {
this.next({ schemas: ImmutableArray.of() });
}
return this.schemasService.getSchemas(this.appName)
.do(dtos => {
return this.next(s => {
const schemas = ImmutableArray.of(dtos).sortByStringAsc(x => x.displayName);
return { ...s, schemas, isLoaded: true };
return { ...s, schemas, schemasApp: this.appName, isLoaded: true };
});
})
.notify(this.dialogs);

Loading…
Cancel
Save