From dfcd1dbb64fd4f8f2eecbf10f8afe849cc3954b7 Mon Sep 17 00:00:00 2001 From: ajnart Date: Sat, 8 Aug 2026 18:24:38 +0200 Subject: [PATCH] fix: guard recursive section rendering --- .../board/sections/gridstack/gridstack.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 apps/nextjs/src/components/board/sections/gridstack/gridstack.spec.ts diff --git a/apps/nextjs/src/components/board/sections/gridstack/gridstack.spec.ts b/apps/nextjs/src/components/board/sections/gridstack/gridstack.spec.ts new file mode 100644 index 000000000..3df5c1a38 --- /dev/null +++ b/apps/nextjs/src/components/board/sections/gridstack/gridstack.spec.ts @@ -0,0 +1,11 @@ +import { describe, expect, test } from "vitest"; + +import { filterRecursiveInnerSections } from "./gridstack"; + +describe("filterRecursiveInnerSections", () => { + test("removes sections that would recursively render an ancestor", () => { + const innerSections = [{ id: "safe" }, { id: "parent" }, { id: "root" }]; + + expect(filterRecursiveInnerSections(innerSections, new Set(["root", "parent"]))).toEqual([{ id: "safe" }]); + }); +});