fix(collapse-subtree): improve performance of collapsing subtrees from O(n) to O(v) (#6971)

This commit is contained in:
Elian Doran 2025-09-14 18:27:29 +03:00 committed by GitHub
commit 7588026640
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -163,6 +163,7 @@ function setExpandedForSubtree(req: Request) {
SELECT branches.branchId, branches.noteId FROM branches SELECT branches.branchId, branches.noteId FROM branches
JOIN tree ON branches.parentNoteId = tree.noteId JOIN tree ON branches.parentNoteId = tree.noteId
WHERE branches.isDeleted = 0 WHERE branches.isDeleted = 0
AND branches.isExpanded = 1
) )
SELECT branchId FROM tree`, SELECT branchId FROM tree`,
[branchId] [branchId]