From 3b7318507186f73522d90dee1239ff0f973d392a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 22 Apr 2018 16:24:02 +0200 Subject: [PATCH] Unload schemas when app is changed. --- src/Squidex/app/shared/state/schemas.state.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Squidex/app/shared/state/schemas.state.ts b/src/Squidex/app/shared/state/schemas.state.ts index 197eb8d03..c35c2478d 100644 --- a/src/Squidex/app/shared/state/schemas.state.ts +++ b/src/Squidex/app/shared/state/schemas.state.ts @@ -142,6 +142,7 @@ export class AddFieldForm extends Form { } interface Snapshot { + schemasApp?: string; schemas: ImmutableArray; isLoaded?: boolean; @@ -198,12 +199,16 @@ export class SchemasState extends State { } public load(): Observable { + 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);