fix(settings): sync the view-mode toolbar button to the server value on load

viewMode is a synced setting. On launch localStorage is wiped (ephemeral port
= new origin) so state.viewMode defaults to 'cards' and applyViewMode()
highlights the cards button. loadServerSettings then set state.viewMode='table'
and re-rendered the content (table) but never re-synced the .view-btn
highlight or the column-picker — so table content showed under a cards-active
toolbar. Re-apply both in the visual-settings block, alongside theme/sidebar.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-21 19:24:09 +01:00
parent 370432f638
commit 5799407f55
+8
View File
@@ -6794,6 +6794,14 @@ async function loadServerSettings() {
// Apply visual settings immediately.
if (remote.theme) setTheme(remote.theme);
if ('sidebarCollapsed' in remote) applySidebarCollapsed();
// viewMode's active-button highlight + column-picker visibility were
// set once at init from the (port-wiped) localStorage default 'cards';
// re-sync them to the server value so the toolbar matches the content.
if ('viewMode' in remote) {
$$('.view-btn').forEach(b =>
b.classList.toggle('is-active', b.dataset.view === state.viewMode));
applyColsWrapVisibility();
}
} catch (e) {
// Network/server hiccup is harmless — localStorage cache still works.
}