fix(sidebar): avoid synchronous selection pruning

This commit is contained in:
t8y2 committed 2026-08-18 15:47:44 +08:00
1 parent 94949eb1c7
commit 0b49c5a761
4 files changed
+59 -12

No files matched your search

@@ -0,0 +1,16 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const connectionTreeSource = readFileSync(new URL("../ConnectionTree.vue", import.meta.url), "utf8");
describe("ConnectionTree selection pruning", () => {
it("does not track the visible tree outside multi-selection", () => {
expect(connectionTreeSource).toContain("store.connectionMultiSelectActive || store.selectedTreeNodeIds.length > 1");
expect(connectionTreeSource).toContain("hasTreeMultiSelection.value ? flatTreeIndex.value.nodeById : null");
expect(connectionTreeSource).not.toMatch(/watch\(\s*visibleNodes,/);
});
it("defers selection cleanup until after the tree render", () => {
expect(connectionTreeSource).toMatch(/pruneTreeSelectionToVisibleNodeIds[\s\S]*?\{ flush: "post" \}/);
});
});