From 75e5c594f1d0bcb7f1c1ee29c23379ac533067b5 Mon Sep 17 00:00:00 2001 From: AKIBUZZAMAN AKIB Date: Wed, 15 Apr 2026 18:55:02 +0000 Subject: [PATCH] fix(ui): prevent showControls cross-tab state leak via localStorage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #23232. Opening an Artifacts preview in one tab would silently write localStorage.showControls = 'true' through an unconditional store subscriber in (app)/+layout.svelte. Any tab navigating to Home after that would read the value on mount and auto-expand the Controls panel, even though the user never interacted with it. Root cause: showControls.subscribe() in onMount() persisted every store mutation to localStorage — including programmatic ones triggered by Artifacts, Citations, and other internal components. Fix: remove the subscriber from the layout. The layout still reads localStorage.showControls once on mount to restore the user's last preference. Persistence is now only written in Navbar.svelte when the user explicitly clicks the Controls toggle button, keeping localStorage in sync with deliberate user intent only. No behaviour change for users who manually toggle Controls — their preference is still saved and restored across page loads. --- src/lib/components/chat/Navbar.svelte | 4 +++- src/routes/(app)/+layout.svelte | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/components/chat/Navbar.svelte b/src/lib/components/chat/Navbar.svelte index 5c4e1364b4..dc4251a36b 100644 --- a/src/lib/components/chat/Navbar.svelte +++ b/src/lib/components/chat/Navbar.svelte @@ -217,7 +217,9 @@