You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Performance: Use SurrealDB recursive FETCH to return nested tree on initial load #602
Currently, the frontend receives a flat array of nodes and edges from the backend, then reconstructs the tree structure in visibleNodesFromStores using flattenNodes(). This happens on every reactive change, causing unnecessary CPU work.
Proposed Solution
Use SurrealDB's recursive FETCH capability to return a pre-built nested tree structure from the backend:
SELECT*, ->has_child->(node ORDER BY->has_child.order).*AS children
FROM node:parent
FETCH children
Backend Changes Required
packages/core/src/operations/mod.rs or services/node_service.rs:
Add get_children_tree(parent_id) function that returns nested structure
Use SurrealDB recursive FETCH to build tree in database
When implementing this issue, consider whether the HierarchyRelationship type (from event-types.ts) needs adjustment.
Current assessment: Likely minimal impact.
The nested tree response from recursive FETCH may embed children directly in nodes, which could reduce usage of HierarchyRelationship for the initial load path. However, the type will still be needed for:
LIVE SELECT events (edge:created, edge:deleted, edge:updated)
Incremental updates after initial load
The underlying edge fields (id, in, out, order) won't change - only the response shape (nested vs flat).
Reference: HierarchyRelationship was introduced in PR #604 to abstract SurrealDB's edge format from frontend code.
Activity
feat: implement recursive FETCH for nested tree structure
Address code review recommendations from PR #604
Post-migration fixes: terminology cleanup, edge abstraction, placehol…
malibio commentedon Nov 22, 2025
Note: HierarchyRelationship Type
When implementing this issue, consider whether the
HierarchyRelationshiptype (fromevent-types.ts) needs adjustment.Current assessment: Likely minimal impact.
The nested tree response from recursive FETCH may embed children directly in nodes, which could reduce usage of
HierarchyRelationshipfor the initial load path. However, the type will still be needed for:edge:created,edge:deleted,edge:updated)The underlying edge fields (
id,in,out,order) won't change - only the response shape (nested vs flat).Reference:
HierarchyRelationshipwas introduced in PR #604 to abstract SurrealDB's edge format from frontend code.Implement recursive FETCH for optimized initial tree load (Issue #602)
Performance: Use SurrealDB recursive FETCH to return nested tree on i…
Fix browser dev mode: indent/outdent UI, structure tree, children-tre…
Fix: Enter key on child nodes creating sibling at wrong hierarchy lev…
Post-migration fixes: terminology cleanup, edge abstraction, placehol…
Performance: Use SurrealDB recursive FETCH to return nested tree on i…
Fix: Enter key on child nodes creating sibling at wrong hierarchy lev…
Post-migration fixes: terminology cleanup, edge abstraction, placehol…
Performance: Use SurrealDB recursive FETCH to return nested tree on i…
Fix: Enter key on child nodes creating sibling at wrong hierarchy lev…
Post-migration fixes: terminology cleanup, edge abstraction, placehol…
Performance: Use SurrealDB recursive FETCH to return nested tree on i…
Fix: Enter key on child nodes creating sibling at wrong hierarchy lev…