[PR #23259] [CLOSED] fix: use sessionStorage for showControls to prevent cross-tab state leakage #65964

Closed
opened 2026-05-06 12:03:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23259
Author: @karthik-idikuda
Created: 3/31/2026
Status: Closed

Base: mainHead: fix/cross-tab-showcontrols-state-leak


📝 Commits (1)

  • 49532b8 fix: use sessionStorage for showControls to prevent cross-tab state leakage

📊 Changes

1 file changed (+5 additions, -2 deletions)

View changed files

📝 src/routes/(app)/+layout.svelte (+5 -2)

📄 Description

Problem

Opening an Artifacts preview in one browser tab automatically expands the Advanced Settings/Controls panel on the Home page in another tab, without user action.

Root Cause

In src/routes/(app)/+layout.svelte, the showControls store state is persisted via localStorage:

await showControls.set(!$mobile ? localStorage.showControls === 'true' : false);
showControls.subscribe((value) => {
    localStorage.showControls = value ? 'true' : 'false';
});

Since localStorage is shared across all tabs of the same origin:

  1. Tab A: User opens Artifacts preview -> showControls.set(true) -> subscription writes localStorage.showControls = 'true'
  2. Tab B: User navigates to Home -> onMount reads localStorage.showControls === 'true' -> controls panel auto-expands

Fix

Switch from localStorage to sessionStorage for persisting showControls. sessionStorage is isolated per browser tab/session, so each tab maintains its own independent controls panel state. This preserves the within-tab persistence (controls stay open across SPA navigation within the same tab) while eliminating cross-tab leakage.

Note: chatControlsSize (the panel width) intentionally remains in localStorage so the user's preferred panel width is preserved globally.

Fixes #23232


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23259 **Author:** [@karthik-idikuda](https://github.com/karthik-idikuda) **Created:** 3/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/cross-tab-showcontrols-state-leak` --- ### 📝 Commits (1) - [`49532b8`](https://github.com/open-webui/open-webui/commit/49532b8a8f3c63ec2df680cdae6976deefaf5425) fix: use sessionStorage for showControls to prevent cross-tab state leakage ### 📊 Changes **1 file changed** (+5 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/routes/(app)/+layout.svelte` (+5 -2) </details> ### 📄 Description ## Problem Opening an Artifacts preview in one browser tab automatically expands the Advanced Settings/Controls panel on the Home page in another tab, without user action. ### Root Cause In `src/routes/(app)/+layout.svelte`, the `showControls` store state is persisted via `localStorage`: ```js await showControls.set(!$mobile ? localStorage.showControls === 'true' : false); showControls.subscribe((value) => { localStorage.showControls = value ? 'true' : 'false'; }); ``` Since `localStorage` is shared across all tabs of the same origin: 1. **Tab A**: User opens Artifacts preview -> `showControls.set(true)` -> subscription writes `localStorage.showControls = 'true'` 2. **Tab B**: User navigates to Home -> `onMount` reads `localStorage.showControls === 'true'` -> controls panel auto-expands ## Fix Switch from `localStorage` to `sessionStorage` for persisting `showControls`. `sessionStorage` is isolated per browser tab/session, so each tab maintains its own independent controls panel state. This preserves the within-tab persistence (controls stay open across SPA navigation within the same tab) while eliminating cross-tab leakage. Note: `chatControlsSize` (the panel width) intentionally remains in `localStorage` so the user's preferred panel width is preserved globally. Fixes #23232 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 12:03:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#65964