Frontmatter
| id | 9429 |
| title | TreeStore: Implement ancestor-aware filtering for filter override |
| state | Closed |
| labels | enhancementaiarchitecturegrid |
| assignees | tobiu |
| createdAt | Mar 10, 2026, 2:15 PM |
| updatedAt | Mar 10, 2026, 3:18 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9429 |
| author | tobiu |
| commentsCount | 2 |
| parentIssue | 9404 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Mar 10, 2026, 3:18 PM |
TreeStore: Implement ancestor-aware filtering for filter override
tobiu added parent issue #9404 on Mar 10, 2026, 2:16 PM

tobiu
Mar 10, 2026, 2:36 PM
Input from Gemini 3.1 Pro:
✦ Implementation Guidance for Future Sessions:
Please utilize the Playwright unit testing environment established in
test/playwright/unit/data/TreeStore.spec.mjs.When implementing the ancestor-aware
filteroverride, please add a newtest.describeblock to this file.Testing Requirements:
- Initialize a
TreeStorewith a deep nested hierarchy.- Apply a Filter targeting a specific child node name.
- Assert that the matched child node is present in the
_itemsarray.- Crucially: Assert that all ancestor nodes of that child remain in the
_itemsarray (ignoring their own filter mismatch), ensuring the visual tree path isn't broken.- Ensure the test covers both Turbo Mode (
autoInitRecords: falseusing raw objects) and standard mode (Records).
tobiu assigned to @tobiu on Mar 10, 2026, 3:18 PM

tobiu
Mar 10, 2026, 3:18 PM
Input from Gemini 3.1 Pro:
✦ I have successfully implemented the ancestor-aware filtering override for
TreeStore:
- Ancestor Preservation: When evaluating the tree top-down, if a deep descendant matches the active filters, its
isKeptflag bubbles up through the recursive calls. This forces all of its ancestors to remain visible and automatically setscollapsed = falseso the matched node is immediately visible in the UI.- Descendant Preservation: If an ancestor explicitly matches a filter (e.g. searching for a specific folder), that match cascades down, keeping all of its descendants visible and structurally intact.
- Turbo Mode Safety: Inherited the soft-hydration logic, iterating over the
allRecordsMapto dynamically resolve complex fields before beginning the recursive evaluation, ensuring filtering works optimally without instantiating records.- Knowledge Base Documentation: Detailed JSDoc comments were added to both
doSort()andfilter()using the "Architectural Mechanics" pattern, making the underlying tree projection logic highly queryable for future AI sessions.- Testing: Implemented the "Ancestor-Aware Filtering" test suite in
test/playwright/unit/data/TreeStore.spec.mjs, proving that ancestors are kept and theTurbo Modecorrectly handles structural hierarchies during filtering.Closing this ticket!
tobiu closed this issue on Mar 10, 2026, 3:18 PM
Goal
Implement a custom
filter()override inNeo.data.TreeStorethat ensures ancestor paths remain visible when a child node matches a filter.Context
TreeStoreinheritsfilter()fromCollection.Base, which applies filtering rules strictly to individual records in the flat array. If a user searches for a specific child node name, standard filtering will hide its parent (if the parent's name doesn't match), leaving the child visually orphaned or entirely invisible.Acceptance Criteria
filter()inTreeStore.