fix(sidebar): restore loaded pages after clearing search
This commit is contained in:
7 files changed
+152
-6
No files matched your search
@@ -434,7 +434,9 @@ function collectExpandedObjectSearchTargets(node: TreeNode, tasks: SidebarSearch
|
||||
// back. Its next explicit expansion will load the ordinary first page.
|
||||
node.isExpanded = false;
|
||||
store.discardFilteredTreeNodeChildren(node.id);
|
||||
} else {
|
||||
} else if (!store.restoreFilteredObjectGroupChildren(node)) {
|
||||
// Nothing was captured because the group had not been loaded before the
|
||||
// search, so there is no previous list to put back.
|
||||
tasks.push(() => store.loadObjectGroupChildren(node, { force: true }));
|
||||
}
|
||||
} else if (simpleObjectParentTypes.has(node.type)) {
|
||||
|
||||
+7
@@ -21,6 +21,13 @@ describe("ConnectionTree global search loading", () => {
|
||||
expect(source).toContain("store.discardFilteredTreeNodeChildren(node.id);");
|
||||
});
|
||||
|
||||
it("restores the pre-search children of an expanded group instead of reloading page one", () => {
|
||||
// Clearing a remote search must put back the pages the user had loaded
|
||||
// through "load more"; only an uncaptured group falls back to a reload.
|
||||
expect(source).toContain("} else if (!store.restoreFilteredObjectGroupChildren(node)) {");
|
||||
expect(source).toMatch(/restoreFilteredObjectGroupChildren\(node\)\) \{[\s\S]*?tasks\.push\(\(\) => store\.loadObjectGroupChildren\(node, \{ force: true \}\)\);/);
|
||||
});
|
||||
|
||||
it("limits concurrent metadata loads without dropping a task", async () => {
|
||||
let activeTasks = 0;
|
||||
let maximumActiveTasks = 0;
|
||||
|
||||
Reference in new issue
Block a user