Frontmatter
| title | feat: implement updateKey() method for Neo.collection.Base #9196 |
| author | jhawpetoss6-collab |
| state | Merged |
| createdAt | Mar 24, 2026, 2:27 AM |
| updatedAt | Mar 24, 2026, 9:53 AM |
| closedAt | Mar 24, 2026, 9:53 AM |
| mergedAt | Mar 24, 2026, 9:53 AM |
| branches | dev ← strike/collection-update-key |
| url | https://github.com/neomjs/neo/pull/9536 |

Hello and welcome to the Neo.mjs project! Thank you for picking up this ticket and for your contribution.
This is a great implementation of the baseline requirement. Providing a clean way to update keys without triggering expensive array re-sorts via remove/add cycles is a very welcome addition to the Collection core.
Since this is a brand new method and isn't actively wired up to the rest of the framework yet, it is low risk, and we are happy to accept and merge this PR as your first official contribution!
To make this feature fully robust across the entire framework architecture, we will need to handle a couple of edge cases (specifically, filtered collections and the newly introduced TreeStore). We have created two follow-up tickets to track these integrations:
- #9538: Enhance
Collection.updateKey()to support filtered collections (allItemsmap). - #9539: Add
TreeStoreoverride forupdateKey()to ensure private structural maps stay in sync.
We will merge this PR now. If you are interested in continuing to work on this feature, you are more than welcome to claim either of those follow-up tickets—just drop a comment on them!
Thank you again for jumping in, and we look forward to reviewing your next PR.
This PR implements the
updateKey(item, newKey)method forNeo.collection.Base, addressing the need for safe key updates within collections (#9196).Changes:
updateKey()to the Collection base class.mapstays in sync with the item property.updateKeyevent for observability./claim #9196