fixed possible render error

This commit is contained in:
Jan Prochazka
2025-11-04 08:27:36 +01:00
parent a324cf0fcd
commit a7cfe7fe04

View File

@@ -103,11 +103,11 @@ export class TableGridDisplay extends GridDisplay {
isChecked: this.isColumnChecked(col),
hintColumnNames:
this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)?.columns?.map(columnName =>
shortenIdentifier(`hint_${col.uniqueName}_${columnName}`, this.driver.dialect.maxIdentifierLength)
shortenIdentifier(`hint_${col.uniqueName}_${columnName}`, this.driver?.dialect?.maxIdentifierLength)
) || null,
hintColumnDelimiter: this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)
?.delimiter,
uniqueNameShorten: shortenIdentifier(col.uniqueName, this.driver.dialect.maxIdentifierLength),
uniqueNameShorten: shortenIdentifier(col.uniqueName, this.driver?.dialect?.maxIdentifierLength),
isExpandable: !!col.foreignKey,
})) || []
);
@@ -118,7 +118,7 @@ export class TableGridDisplay extends GridDisplay {
if (this.isExpandedColumn(column.uniqueName)) {
const table = this.getFkTarget(column);
if (table) {
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength);
const subcolumns = this.getDisplayColumns(table, column.uniquePath);
this.addReferenceToSelect(select, parentAlias, column);
@@ -131,8 +131,8 @@ export class TableGridDisplay extends GridDisplay {
}
addReferenceToSelect(select: Select, parentAlias: string, column: DisplayColumn) {
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
if ((select.from.relations || []).find(x => x.alias == childAlias)) return;
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength);
const table = this.getFkTarget(column);
if (table && table.primaryKey) {
select.from.relations = [
@@ -196,11 +196,11 @@ export class TableGridDisplay extends GridDisplay {
this.addReferenceToSelect(
select,
parentUniqueName
? shortenIdentifier(`${parentUniqueName}_ref`, this.driver.dialect.maxIdentifierLength)
? shortenIdentifier(`${parentUniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength)
: 'basetbl',
column
);
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
const childAlias = shortenIdentifier(`${column.uniqueName}_ref`, this.driver?.dialect?.maxIdentifierLength);
select.columns.push(
...hintDescription.columns.map(
columnName =>
@@ -209,7 +209,7 @@ export class TableGridDisplay extends GridDisplay {
columnName,
alias: shortenIdentifier(
`hint_${column.uniqueName}_${columnName}`,
this.driver.dialect.maxIdentifierLength
this.driver?.dialect?.maxIdentifierLength
),
source: { alias: childAlias },
} as ColumnRefExpression)