[CORD-1896] GUI become irresponsive
Change-Id: Iad4f09dbeb17e707037e277e86e678b82d06d72e
(cherry picked from commit 04f487c17d7062638e60332a9468580f41658c8d)
diff --git a/src/app/views/crud/crud.relations.service.ts b/src/app/views/crud/crud.relations.service.ts
index f6a7015..092dda8 100644
--- a/src/app/views/crud/crud.relations.service.ts
+++ b/src/app/views/crud/crud.relations.service.ts
@@ -23,6 +23,7 @@
import {IXosFormCfg} from '../../core/form/form';
import {IXosTableCfg} from '../../core/table/table';
import {IXosConfigHelpersService} from '../../core/services/helpers/config.helpers';
+import {Subscription} from 'rxjs';
interface IXosCrudRelationBaseTabData {
model: any;
@@ -64,7 +65,7 @@
public getModel (r: IXosModelRelation, id: string | number): Promise<IXosCrudRelationFormTabData> {
const d = this.$q.defer();
- this.XosModelStore.get(r.model, id)
+ const subscription: Subscription = this.XosModelStore.get(r.model, id)
.subscribe(
item => {
this.$log.debug(`[XosCrud] Loaded manytoone relation with ${r.model} on ${r.on_field}`, item);
@@ -76,6 +77,8 @@
};
d.resolve(data);
+
+ subscription.unsubscribe();
},
err => d.reject
);
@@ -84,7 +87,6 @@
public getModels(r: IXosModelRelation, source_id: string | number): Promise<IXosCrudRelationTableTabData> {
const d = this.$q.defer();
-
this.XosModelStore.query(r.model)
.subscribe(
items => {