From b117663856eba6ef1d30ffe99291465e67a71355 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 27 Aug 2024 19:58:12 +0000 Subject: [PATCH] fix: handle id value properly --- packages/nocodb/src/db/BaseModelSqlv2.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index fac240a4a8..5b2be22e15 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -6472,7 +6472,7 @@ class BaseModelSqlv2 { return pkValues; } else if (this.model.primaryKey) { return ( - data[this.model.primaryKey.title] || + data[this.model.primaryKey.title] ?? data[this.model.primaryKey.column_name] ); } else { @@ -8747,7 +8747,7 @@ class BaseModelSqlv2 { typeof childIds[0] === 'object' ? childIds.map( (c) => - c[parentTable.primaryKey.title] || + c[parentTable.primaryKey.title] ?? c[parentTable.primaryKey.column_name], ) : childIds, @@ -8830,7 +8830,7 @@ class BaseModelSqlv2 { typeof childIds[0] === 'object' ? childIds.map( (c) => - c[parentTable.primaryKey.title] || + c[parentTable.primaryKey.title] ?? c[parentTable.primaryKey.column_name], ) : childIds, @@ -8871,7 +8871,7 @@ class BaseModelSqlv2 { typeof childIds[0] === 'object' ? childIds.map( (c) => - c[childTable.primaryKey.title] || + c[childTable.primaryKey.title] ?? c[childTable.primaryKey.column_name], ) : childIds, @@ -9113,7 +9113,7 @@ class BaseModelSqlv2 { (r) => r[parentColumn.column_name] === (typeof id === 'object' - ? id[parentTable.primaryKey.title] || + ? id[parentTable.primaryKey.title] ?? id[parentTable.primaryKey.column_name] : id), ), @@ -9139,7 +9139,7 @@ class BaseModelSqlv2 { typeof childIds[0] === 'object' ? childIds.map( (c) => - c[parentTable.primaryKey.title] || + c[parentTable.primaryKey.title] ?? c[parentTable.primaryKey.column_name], ) : childIds, @@ -9182,7 +9182,7 @@ class BaseModelSqlv2 { parentTable.primaryKey.column_name, childIds.map( (c) => - c[parentTable.primaryKey.title] || + c[parentTable.primaryKey.title] ?? c[parentTable.primaryKey.column_name], ), ); @@ -9201,7 +9201,7 @@ class BaseModelSqlv2 { (r) => r[parentColumn.column_name] === (typeof id === 'object' - ? id[parentTable.primaryKey.title] || + ? id[parentTable.primaryKey.title] ?? id[parentTable.primaryKey.column_name] : id), ), @@ -9225,7 +9225,7 @@ class BaseModelSqlv2 { typeof childIds[0] === 'object' ? childIds.map( (c) => - c[parentTable.primaryKey.title] || + c[parentTable.primaryKey.title] ?? c[parentTable.primaryKey.column_name], ) : childIds,