Rewrite host-supplied column field names to the entity's OWN spelling.
A page may reasonably write field: 'name' where the entity says Name, and the grid resolves
host names case-insensitively when it looks up metadata — so such a column renders. But the
spelling does not stay cosmetic: it becomes the AG Grid colDef's field, and therefore its
colId, and therefore the key in captured grid state and sort settings. Meanwhile the row objects
the grid builds are keyed by the ENTITY's spelling. Anything that addresses data or matches state
by that name then misses: cells resolve to undefined, the captured state drops the column, a saved
sort is discarded.
Normalising once, here, is what keeps those two vocabularies from diverging — the alternative is a
case-insensitive comparison at every one of those sites, which is the state that produced the bug.
Unchanged columns are returned by REFERENCE (so callers can detect a no-op cheaply), and changed
ones as copies — the host's own array and objects are never mutated. A name matching no field is
left alone for the existing validation to reject.
Rewrite host-supplied column field names to the entity's OWN spelling.
A page may reasonably write
field: 'name'where the entity saysName, and the grid resolves host names case-insensitively when it looks up metadata — so such a column renders. But the spelling does not stay cosmetic: it becomes the AG Grid colDef'sfield, and therefore itscolId, and therefore the key in captured grid state and sort settings. Meanwhile the row objects the grid builds are keyed by the ENTITY's spelling. Anything that addresses data or matches state by that name then misses: cells resolve to undefined, the captured state drops the column, a saved sort is discarded.Normalising once, here, is what keeps those two vocabularies from diverging — the alternative is a case-insensitive comparison at every one of those sites, which is the state that produced the bug.
Unchanged columns are returned by REFERENCE (so callers can detect a no-op cheaply), and changed ones as copies — the host's own array and objects are never mutated. A name matching no field is left alone for the existing validation to reject.