From 23ebf4331b6aecc101aaad70374329e062bcb648 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 8 Jun 2026 12:14:42 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Use=20DocumentFragment=20for=20side?= =?UTF-8?q?bar=20batch=20fields?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored `updateBatchSidebar` to accumulate generated DOM elements inside a `DocumentFragment` before appending them to the DOM. This significantly reduces layout thrashing during iteration, yielding measurable performance gains when updating many columns. --- core/ui/modules/sidebar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/ui/modules/sidebar.js b/core/ui/modules/sidebar.js index 794e8f72..78e5fbd8 100644 --- a/core/ui/modules/sidebar.js +++ b/core/ui/modules/sidebar.js @@ -258,6 +258,7 @@ export function updateBatchSidebar() { const columns = groupSelectedCellsByColumn(state.selectedCells, state.tableColumns); fieldsContainer.replaceChildren(); + const fragment = document.createDocumentFragment(); for (const [colIdx, colInfo] of columns) { const valueDisplay = summarizeColumnValue(colInfo.values); @@ -309,8 +310,9 @@ export function updateBatchSidebar() { controlsDiv.appendChild(patchBtn); div.appendChild(controlsDiv); - fieldsContainer.appendChild(div); + fragment.appendChild(div); } + fieldsContainer.appendChild(fragment); } export async function applyBatchUpdate() {