fix(frontend): always start with panel closed on document open
Removed localStorage persistence for the open/closed state so the PDF is always visible first when navigating to a document. Height and active tab are still remembered across visits. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -73,7 +73,6 @@ $effect(() => {
|
||||
|
||||
// ── Bottom panel state ────────────────────────────────────────────────────────
|
||||
|
||||
const LS_KEY_OPEN = 'doc-panel-open';
|
||||
const LS_KEY_HEIGHT = 'doc-panel-height';
|
||||
const LS_KEY_TAB = 'doc-panel-tab';
|
||||
|
||||
@@ -86,7 +85,6 @@ let localStorageRestored = $state(false);
|
||||
onMount(() => {
|
||||
navHeight = document.querySelector('header')?.getBoundingClientRect().height ?? 0;
|
||||
|
||||
const savedOpen = localStorage.getItem(LS_KEY_OPEN);
|
||||
const savedHeight = localStorage.getItem(LS_KEY_HEIGHT);
|
||||
const savedTab = localStorage.getItem(LS_KEY_TAB);
|
||||
|
||||
@@ -99,13 +97,6 @@ onMount(() => {
|
||||
const h = parseInt(savedHeight, 10);
|
||||
if (!isNaN(h) && h >= 80) panelHeight = h;
|
||||
}
|
||||
if (savedOpen !== null) {
|
||||
panelOpen = savedOpen === 'true';
|
||||
} else if (!doc.filePath) {
|
||||
// No previous state and no file → open to Metadaten by default
|
||||
panelOpen = true;
|
||||
activeTab = 'metadata';
|
||||
}
|
||||
|
||||
localStorageRestored = true;
|
||||
|
||||
@@ -126,7 +117,6 @@ onMount(() => {
|
||||
// Persist panel state whenever it changes (after initial restore).
|
||||
$effect(() => {
|
||||
if (!localStorageRestored) return;
|
||||
localStorage.setItem(LS_KEY_OPEN, String(panelOpen));
|
||||
localStorage.setItem(LS_KEY_HEIGHT, String(panelHeight));
|
||||
localStorage.setItem(LS_KEY_TAB, activeTab);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user