From e7745468188604c776861730d32c1c38e3ad0c6b Mon Sep 17 00:00:00 2001 From: Horizontal42 <75383519+Horizontal42@users.noreply.github.com> Date: Wed, 8 Jul 2026 14:09:26 +0300 Subject: [PATCH] batch doc-list DOM inserts through a DocumentFragment renderDocList appended each sheet's element straight to the live list, forcing a reflow per item; build them in a fragment and append once. --- src/main.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index e3360f8..a0d754b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -97,6 +97,7 @@ function reorderDoc(srcId: string, targetId: string): void { function renderDocList(): void { const list = $("#doc-list"); list.replaceChildren(); + const frag = document.createDocumentFragment(); for (const doc of data.docs) { const el = document.createElement("div"); el.className = "doc-item" + (doc.id === data.activeId ? " active" : "") + (doc.pinned ? " pinned" : ""); @@ -192,8 +193,9 @@ function renderDocList(): void { saveAppData(data); }); el.appendChild(del); - list.appendChild(el); + frag.appendChild(el); } + list.appendChild(frag); } function switchDoc(id: string): void {