fix: preserve checkbox selection across table re-renders
CI / Build & Test (push) Successful in 3m1s

Snapshot checked row IDs before each innerHTML swap in the virtual hosts,
service tunnels, and server tunnels tables so that periodic refresh cycles
no longer reset multi-selection state.
This commit is contained in:
Raven Scott
2026-03-01 22:03:59 -05:00
parent 73eb9fe783
commit ad292958a8
3 changed files with 15 additions and 0 deletions
@@ -34,6 +34,10 @@ function updateConnectionsTable(state) {
_latencySnapshot[b.dataset.pingHost + ':' + b.dataset.pingPort] = { text: b.textContent, color: b.style.color };
});
// Snapshot checked checkboxes so selection survives the innerHTML swap
const _checkedHostnames = new Set();
tbody.querySelectorAll('.vhost-row-cb:checked').forEach(cb => _checkedHostnames.add(cb.dataset.hostname));
if (virtualHosts.length === 0) {
tbody.innerHTML = `
<tr><td colspan="6">
@@ -103,6 +107,7 @@ function updateConnectionsTable(state) {
});
tbody.querySelectorAll('.vhost-row-cb').forEach(cb => {
if (_checkedHostnames.has(cb.dataset.hostname)) cb.checked = true;
cb.addEventListener('change', _updateVhostBulkBar);
});