Objective
Add updateKey(item, newKey) method to Neo.collection.Base.
Motivation
When updating the key property of an item inside a Collection (e.g. dataField in columnPositions), developers currently have two bad options:
remove(item) + add(item): Breaks array sort order (moves item to end).
- Manual Map surgery:
map.delete(old) + update + map.set(new). Brittle and verbose.
Proposal
Implement updateKey(item, newKey) which:
- Updates the internal
map safely.
- Updates the
internalIdMap if tracked.
- Preserves the item's index in the
_items array (Zero Array Mutation).
- Optionally updates the item's property if it matches
keyProperty.
Use Case
Fixing grid column reordering bugs where dynamic dataField changes break virtualization order.
Objective
Add
updateKey(item, newKey)method toNeo.collection.Base.Motivation
When updating the key property of an item inside a Collection (e.g.
dataFieldincolumnPositions), developers currently have two bad options:remove(item)+add(item): Breaks array sort order (moves item to end).map.delete(old)+ update +map.set(new). Brittle and verbose.Proposal
Implement
updateKey(item, newKey)which:mapsafely.internalIdMapif tracked._itemsarray (Zero Array Mutation).keyProperty.Use Case
Fixing grid column reordering bugs where dynamic
dataFieldchanges break virtualization order.