fix: preserve checkbox selection across table re-renders
CI / Build & Test (push) Successful in 3m1s
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:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user