diff --git a/app.js b/app.js index a04aae71..ad5f42bb 100644 --- a/app.js +++ b/app.js @@ -972,6 +972,7 @@ function createWarningBadge(warning) { } const persistentOwnerColorMap = new Map(); +let ownerBadgeTemplate = null; function createOwnerCellContent(owner) { if (!owner) { @@ -982,18 +983,31 @@ function createOwnerCellContent(owner) { persistentOwnerColorMap.set(owner, OWNER_COLORS[persistentOwnerColorMap.size % OWNER_COLORS.length]); } - const badge = document.createElement('span'); - badge.className = 'owner-badge'; + // ⚡ Bolt: Cache unattached static DOM structures as templates and use `.cloneNode(false)` + // to drastically reduce JS-to-C++ instantiation overhead in hot rendering paths (O(N) tables). + if (!ownerBadgeTemplate) { + ownerBadgeTemplate = document.createElement('span'); + ownerBadgeTemplate.className = 'owner-badge'; + } + const badge = ownerBadgeTemplate.cloneNode(false); badge.style.background = persistentOwnerColorMap.get(owner); badge.textContent = owner; return badge; } +let statusBadgeTemplate = null; + function createStatusCellContent(progressState) { if (!progressState.label) { return createEmptyCell(); } - const badge = document.createElement('span'); + + // ⚡ Bolt: Use cloned templates instead of document.createElement for O(N) rendering. + if (!statusBadgeTemplate) { + statusBadgeTemplate = document.createElement('span'); + } + + const badge = statusBadgeTemplate.cloneNode(false); badge.className = `status-badge ${progressState.className}`; badge.textContent = progressState.label; if (progressState.description) { @@ -1014,12 +1028,24 @@ function createMetricText(value, testId = '') { return metric; } +let actualProgressLabelTemplate = null; +let actualProgressSrOnlyTemplate = null; +let actualProgressValidationTemplate = null; + function createActualProgressCellContent(task, taskMetrics) { - const label = document.createElement('label'); + // ⚡ Bolt: Caching deeply nested/multiple DOM nodes for table cells avoids repetitive C++ bridge overhead. + if (!actualProgressLabelTemplate) { + actualProgressLabelTemplate = document.createElement('label'); + actualProgressSrOnlyTemplate = document.createElement('span'); + actualProgressSrOnlyTemplate.className = 'sr-only'; + actualProgressValidationTemplate = document.createElement('div'); + actualProgressValidationTemplate.className = 'validation-message'; + } + + const label = actualProgressLabelTemplate.cloneNode(false); const fieldId = `actual-progress-${task.id}`; label.htmlFor = fieldId; - const srOnly = document.createElement('span'); - srOnly.className = 'sr-only'; + const srOnly = actualProgressSrOnlyTemplate.cloneNode(false); const rowEntityName = task.task || task.activity || task.phase || '작업'; srOnly.textContent = `실적진척상태 - ${rowEntityName}`; if (!actualProgressSelectTemplate) { @@ -1042,9 +1068,8 @@ function createActualProgressCellContent(task, taskMetrics) { const warning = taskMetrics.plannedDateWarning || taskMetrics.actualDateWarning; if (warning) { - const validation = document.createElement('div'); + const validation = actualProgressValidationTemplate.cloneNode(false); validation.id = `actual-progress-error-${task.id}`; - validation.className = 'validation-message'; validation.textContent = warning; label.appendChild(validation); select.setAttribute('aria-invalid', 'true'); diff --git a/package-lock.json b/package-lock.json index a1c5e22b..079e2031 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "dependencies": { "@hono/node-server": "^2.0.12", - "hono": "^4.13.1" + "hono": "^4.12.32" }, "devDependencies": { "@playwright/test": "1.61.1", @@ -31,9 +31,9 @@ } }, "node_modules/@hono/node-server": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.0.tgz", - "integrity": "sha512-XovyyCCnBzW+zKu+z/zq8hwNs4KOR5rEMAOxo2f40Q5xoOI37IMm6MIg2COOUtUApo0i6850MTBKH2u4QLGIqg==", + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.0.12.tgz", + "integrity": "sha512-eWpQYr67tqJLeaSUl0Q+TquuYfUdTibpOJlUMV2FfUP7+KqCC5TufnwnlXL6mobZBJbGAYRd7ZvEBDCbLInjhg==", "license": "MIT", "engines": { "node": ">=20" @@ -382,9 +382,9 @@ } }, "node_modules/hono": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.1.tgz", - "integrity": "sha512-kdJoFVv2xmayw6cY09H7AbMJMt8Jn5jdlEdXsP7AGBdF2DIptVlKlOLKXP41yPip4/a3yQPv9gVcJYI8YY04dw==", + "version": "4.12.32", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.32.tgz", + "integrity": "sha512-XcuyW9qE2kJn07PkecMOBd5Vq/hMy7mmGw+idz1yblbg9N17ijJODrvPkn7/dwL3Kulj8LcRJ69DLOWf91dRUg==", "license": "MIT", "engines": { "node": ">=16.9.0" diff --git a/package.json b/package.json index 65735b6f..7790e678 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "@hono/node-server": "^2.0.12", - "hono": "^4.13.1" + "hono": "^4.12.32" }, "devDependencies": { "@playwright/test": "1.61.1",