LearnNewsExamplesServices
Frontmatter
id9196
titleFeature: Add Collection.updateKey() method
stateClosed
labels
enhancementcore
assignees[]
createdAtFeb 17, 2026, 3:15 PM
updatedAtMar 24, 2026, 9:54 AM
githubUrlhttps://github.com/neomjs/neo/issues/9196
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 24, 2026, 9:54 AM

Feature: Add Collection.updateKey() method

Closed v12.1.0 enhancementcore
tobiu
tobiu commented on Feb 17, 2026, 3:15 PM

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:

  1. remove(item) + add(item): Breaks array sort order (moves item to end).
  2. Manual Map surgery: map.delete(old) + update + map.set(new). Brittle and verbose.

Proposal

Implement updateKey(item, newKey) which:

  1. Updates the internal map safely.
  2. Updates the internalIdMap if tracked.
  3. Preserves the item's index in the _items array (Zero Array Mutation).
  4. Optionally updates the item's property if it matches keyProperty.

Use Case

Fixing grid column reordering bugs where dynamic dataField changes break virtualization order.

tobiu added the enhancement label on Feb 17, 2026, 3:15 PM
tobiu added the core label on Feb 17, 2026, 3:15 PM
tobiu referenced in commit bd7bab2 - "Merge pull request #9536 from jhawpetoss6-collab/strike/collection-update-key on Mar 24, 2026, 9:53 AM
tobiu
tobiu Mar 24, 2026, 9:54 AM

Closed via PR #9536

tobiu closed this issue on Mar 24, 2026, 9:54 AM