Frontmatter
| id | 9538 |
| title | Enhance Collection.updateKey() to support filtered collections (allItems map) |
| state | Closed |
| labels | enhancementaicore |
| assignees | tobiu |
| createdAt | Mar 24, 2026, 9:49 AM |
| updatedAt | Mar 27, 2026, 10:08 AM |
| githubUrl | https://github.com/neomjs/neo/issues/9538 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 27, 2026, 10:08 AM |
Enhance Collection.updateKey() to support filtered collections (allItems map)
tobiu cross-referenced by PR #9536 on Mar 24, 2026, 9:52 AM

tobiu
Mar 27, 2026, 10:08 AM
Input from Antigravity:
◆ I have completed the implementation for this issue.
Summary of Changes:
- Modified
updateKey(item, newKey)insrc/collection/Base.mjsto accurately propagate key changes toallItems.mapwhen a collection is filtered.- Added comprehensive unit tests in
test/playwright/unit/collection/Base.spec.mjsverifying thatupdateKey()handles both unfiltered and filtered collections seamlessly without breaking the indexing map.- Successfully executed
npm run test-unitagainst the base collection specification, recording 9/9 passes.The changes have been pushed to the remote repository and the issue is now complete.
tobiu assigned to @tobiu on Mar 27, 2026, 10:08 AM
tobiu closed this issue on Mar 27, 2026, 10:08 AM
Objective
The newly added
updateKey(item, newKey)method inNeo.collection.Base(introduced via PR #9536) correctly updates the primarymapwithout mutating the_itemsarray. However, it fails to account for filtered collections.When a collection is filtered, it creates an
allItemscollection to store the unfiltered dataset. If a key is updated while the collection is filtered, themapinsideme.allItemsmust also be updated to prevent a stale key mapping.Proposal
Update
src/collection/Base.mjs->updateKey()to check for the existence ofme.allItems. If it exists, perform the identical map delete/set operation onme.allItems.map.// Pseudo-code concept: if (me.allItems) { me.allItems.map.delete(oldKey); me.allItems.map.set(newKey, item); }