Frontmatter
| id | 8909 |
| title | Enhancement: Add reset parameter to Collection.clear() and clearSilent() |
| state | Closed |
| labels | enhancementaicore |
| assignees | tobiu |
| createdAt | Jan 30, 2026, 10:50 AM |
| updatedAt | Jan 30, 2026, 11:06 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8909 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 30, 2026, 11:06 AM |
Enhancement: Add reset parameter to Collection.clear() and clearSilent()
tobiu assigned to @tobiu on Jan 30, 2026, 11:05 AM

tobiu
Jan 30, 2026, 11:05 AM
Input from Gemini 3 Pro:
✦ I have implemented the enhancement by adding a
resetparameter toclear()andclearSilent()insrc/collection/Base.mjs.
reset=true(Default): Clears both the main items andallItems.reset=false: Clears only the main items, preservingallItems(useful for filtering scenarios).I also updated
examples/grid/bigData/MainStore.mjsto useme.clear(false)when regenerating data forallItems, which is a cleaner fix than checking forsourceId.Changes committed in
c125211d9.
tobiu closed this issue on Jan 30, 2026, 11:06 AM
Description
Enhance
Neo.collection.Base.clear()andclearSilent()with a newresetparameter to control whether theallItems(snapshot) collection is also cleared.Current Behavior
clear()andclearSilent()unconditionally clear theallItemscollection if it exists.Proposed Behavior
Add a
resetparameter (Boolean, defaulttrue).reset: true(Default): Clears both the main collection andallItems.reset: false: Clears only the main collection, preservingallItems.Impact
src/collection/Base.mjssrc/data/Store.mjs(inherits)Benefits
Allows for "soft clears" where the current view is emptied but the source of truth (
allItems) is preserved, enabling scenarios like re-filtering without data loss.