From bcbcae1d9d68b8d89b98a2b68ac741772c80ba52 Mon Sep 17 00:00:00 2001 From: dborup Date: Sat, 18 Jul 2026 15:39:02 +0200 Subject: [PATCH] fix: retroactively show newly-added table columns for saved column prefs The Packets column-visibility toggle persists an explicit array of visible column keys to localStorage. A returning visitor with a pre-existing saved array (from before the Scope column existed) never got it shown, since the load path used the saved array verbatim instead of reconciling it against the current COL_DEFS. Missing keys now default to visible (unless narrow-viewport-hidden), same as a fresh visitor gets. Co-Authored-By: Claude Sonnet 5 --- public/packets.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/packets.js b/public/packets.js index e056ef92..b5ca9254 100644 --- a/public/packets.js +++ b/public/packets.js @@ -2025,7 +2025,15 @@ try { visibleCols = JSON.parse(localStorage.getItem('packets-visible-cols')); } catch {} - if (!visibleCols) visibleCols = COL_DEFS.map(c => c.key).filter(k => !defaultHidden.includes(k)); + if (!visibleCols) { + visibleCols = COL_DEFS.map(c => c.key).filter(k => !defaultHidden.includes(k)); + } else { + // A saved preference predates a since-added column (e.g. "scope") — + // default new columns to visible instead of silently hiding them. + for (const c of COL_DEFS) { + if (!visibleCols.includes(c.key) && !defaultHidden.includes(c.key)) visibleCols.push(c.key); + } + } const colMenu = document.getElementById('colToggleMenu'); const pktTable = document.getElementById('pktTable'); function applyColVisibility() {