From 1bd4b777449524d5eb5e5851c191a5a88a851078 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 25 Aug 2022 18:31:55 +0200 Subject: [PATCH] fix --- packages/datalib/src/PerspectiveTreeNode.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/datalib/src/PerspectiveTreeNode.ts b/packages/datalib/src/PerspectiveTreeNode.ts index d8bdf4cb..ccbc4881 100644 --- a/packages/datalib/src/PerspectiveTreeNode.ts +++ b/packages/datalib/src/PerspectiveTreeNode.ts @@ -154,6 +154,11 @@ export abstract class PerspectiveTreeNode { return this.dbs?.[this.databaseConfig.conid]?.[this.databaseConfig.database]; } + hasDesignerIdInIncestors(designerId: string): boolean { + if (designerId == this.designerId) return true; + return this.parentNode?.hasDesignerIdInIncestors(designerId) || false; + } + getChildMatchColumns() { return []; } @@ -940,7 +945,9 @@ function findDesignerIdForNode( x.columns.map(x => x.target) ) ); - if (ref1) return nodeCreateFunc(ref1.targetId); + if (ref1 && !parentNode.hasDesignerIdInIncestors(ref1.targetId)) { + return nodeCreateFunc(ref1.targetId); + } const ref2 = config.references.find( x => @@ -954,7 +961,9 @@ function findDesignerIdForNode( x.columns.map(x => x.target) ) ); - if (ref2) return nodeCreateFunc(ref2.sourceId); + if (ref2 && !parentNode.hasDesignerIdInIncestors(ref2.sourceId)) { + return nodeCreateFunc(ref2.sourceId); + } return node; }