Compare commits

...
Author SHA1 Message Date
dc e4ec4ec629 fix(editor): assign columnHeader before the grid renders
Build / Build-and-ng-test (pull_request) Successful in 5m41s
Lighthouse Checks / lighthouse (pull_request) Successful in 20m53s
Build / Build-and-test-development (pull_request) Failing after 33m28s
The derived-block marker (dc-derived-first) landed on the wrong column, so the
computed columns did not read as a group and derived-variables.cy.ts failed on
the header assertion.

initSetup reversed the order it needs: hot.updateSettings() installs
afterGetColHeader / afterGetCellMeta at line ~4167 and renders, but
this.columnHeader was only assigned at line ~4506 - after that render. The
hooks therefore resolved visual column indexes against the previous table's
list, so 'is this the first derived column' compared an index in one array
against an index in another. The header name check still matched, which is why
dc-derived-header appeared while its sibling class did not.

columnHeader is now taken from headerColumns once, where that list is final
(the Delete? rename and the EDIT_STATUS append have been applied), and the
later divergent copy is gone - it never carried EDIT_STATUS, so it could not
have matched the grid anyway. Comments at both sites record why the order
matters.
2026-10-27 21:42:53 +00:00
+16 -5
View File
@@ -4022,6 +4022,19 @@ export class EditorComponent
// rules must stay index-aligned with headerColumns).
this.headerColumns.push(EDIT_STATUS_COLUMN_NAME)
/**
* columnHeader is the same list, taken once it is final (Delete? renamed,
* EDIT_STATUS appended) - it is the grid's own column order, which is what
* every hook that maps a visual column index to a name needs.
*
* This has to happen HERE, before the updateSettings below installs
* afterGetColHeader / afterGetCellMeta: those fire during the render that
* updateSettings triggers, and reading a columnHeader that was still being
* assigned further down meant they saw the previous table's columns (or
* nothing). That is what put the derived-block marker on the wrong column.
*/
this.columnHeader = this.headerColumns.slice()
if (response.data.sasparams[0].DTVARS !== '') {
this.dateHeaders = response.data.sasparams[0].DTVARS.split(' ')
}
@@ -4143,8 +4156,9 @@ export class EditorComponent
this.dataSourceUnchanged = this.helperService.deepClone(this.dataSource)
this.overlayFormulaRawValuesOnUnchanged(this.dataSourceUnchanged)
// Note: this.headerColumns and this.columnHeader contains same data
// need to resolve redundancy
// columnHeader is a copy of headerColumns taken above, once the Delete?
// rename and the EDIT_STATUS append had been applied - the hooks read it
// for grid-index-to-name mapping, so the two must not drift apart again.
// default schema - includes NOTNULL defaults from DQ rules
for (let i = 0; i < this.headerColumns.length; i++) {
@@ -4503,9 +4517,6 @@ export class EditorComponent
// hot.getPlugin('manualColumnFreeze').freezeColumn(0);
this.queryText = response.data.sasparams[0].FILTER_TEXT
this.columnHeader = response.data.sasparams[0].COLHEADERS.split(',')
// First column is always used to mark records for deletion
this.columnHeader[0] = 'Delete?'
this.readOnlyFields = response.data.sasparams[0].PKCNT
hot.addHook(