LearnNewsExamplesServices
Frontmatter
id8909
titleEnhancement: Add reset parameter to Collection.clear() and clearSilent()
stateClosed
labels
enhancementaicore
assigneestobiu
createdAtJan 30, 2026, 10:50 AM
updatedAtJan 30, 2026, 11:06 AM
githubUrlhttps://github.com/neomjs/neo/issues/8909
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 30, 2026, 11:06 AM

Enhancement: Add reset parameter to Collection.clear() and clearSilent()

Closed v11.24.0 enhancementaicore
tobiu
tobiu commented on Jan 30, 2026, 10:50 AM

Description

Enhance Neo.collection.Base.clear() and clearSilent() with a new reset parameter to control whether the allItems (snapshot) collection is also cleared.

Current Behavior

clear() and clearSilent() unconditionally clear the allItems collection if it exists.

Proposed Behavior

Add a reset parameter (Boolean, default true).

  • reset: true (Default): Clears both the main collection and allItems.
  • reset: false: Clears only the main collection, preserving allItems.

Impact

  • src/collection/Base.mjs
  • src/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.

tobiu added the enhancement label on Jan 30, 2026, 10:50 AM
tobiu added the ai label on Jan 30, 2026, 10:50 AM
tobiu added the core label on Jan 30, 2026, 10:50 AM
tobiu assigned to @tobiu on Jan 30, 2026, 11:05 AM
tobiu
tobiu Jan 30, 2026, 11:05 AM

Input from Gemini 3 Pro:

✦ I have implemented the enhancement by adding a reset parameter to clear() and clearSilent() in src/collection/Base.mjs.

  • reset=true (Default): Clears both the main items and allItems.
  • reset=false: Clears only the main items, preserving allItems (useful for filtering scenarios).

I also updated examples/grid/bigData/MainStore.mjs to use me.clear(false) when regenerating data for allItems, which is a cleaner fix than checking for sourceId.

Changes committed in c125211d9.

tobiu referenced in commit c125211 - "feat: Add reset param to clear()/clearSilent(), use clear(false) in BigData demo (#8909)" on Jan 30, 2026, 11:05 AM
tobiu closed this issue on Jan 30, 2026, 11:06 AM