From 939279dbfb2a1f3acd5a2985630be95f6c9e86d3 Mon Sep 17 00:00:00 2001 From: Aref Shafaei Date: Fri, 20 Oct 2023 18:29:02 -0700 Subject: [PATCH] properly check duplicates between columns and related entities --- js/reference.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/js/reference.js b/js/reference.js index 81874d62..e3d30dcf 100644 --- a/js/reference.js +++ b/js/reference.js @@ -2578,15 +2578,12 @@ for(var i = 0; i < visibleFKs.length; i++) { fkr = visibleFKs[i]; - // if in the visible columns list - if (currentColumns[fkr.name]) { - continue; - } - + var relatedRef, fkName; if (fkr.isPath) { // since we're sure that the pseudoColumn either going to be // general pseudoColumn or InboundForeignKeyPseudoColumn then it will have reference - this._related.push(module._createPseudoColumn(this, fkr.sourceObjectWrapper, tuple).reference); + relatedRef = module._createPseudoColumn(this, fkr.sourceObjectWrapper, tuple).reference; + fkName = relatedRef.pseudoColumn.name; } else { fkr = fkr.foreignKey; @@ -2595,9 +2592,14 @@ fkr._table._baseTable === this._table && fkr._table._altForeignKey === fkr) { continue; } + relatedRef = this._generateRelatedReference(fkr, tuple, true); + fkName = _sourceColumnHelpers.generateForeignKeyName(fkr, true); + } - this._related.push(this._generateRelatedReference(fkr, tuple, true)); + if (currentColumns[fkName]) { + continue; } + this._related.push(relatedRef); } if (notSorted && this._related.length !== 0) {