From df3ddd7a81222ed653c3fb4935e7028181b3e0c8 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Wed, 8 Apr 2026 22:13:48 -0700 Subject: [PATCH] [Fix] Let setSecureItem propagate storage errors to callers Remove the silent try/catch from setSecureItem so OAuth hooks can surface actionable "enable storage" guidance instead of a cryptic "state lost" error after the round-trip. Add a local try/catch in ChatUI where the storage write is non-critical. --- .../src/components/playground/chat_ui/ChatUI.tsx | 8 ++++++-- ui/litellm-dashboard/src/utils/secureStorage.ts | 6 +----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx index b93921a29eb..06a09ca2c37 100644 --- a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx +++ b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx @@ -348,8 +348,12 @@ const ChatUI: React.FC = ({ ]); useEffect(() => { - setSecureItem("apiKeySource", JSON.stringify(apiKeySource)); - setSecureItem("apiKey", apiKey); + try { + setSecureItem("apiKeySource", JSON.stringify(apiKeySource)); + setSecureItem("apiKey", apiKey); + } catch { + // Storage full or unavailable — non-critical, skip persisting. + } sessionStorage.setItem("endpointType", endpointType); sessionStorage.setItem("selectedTags", JSON.stringify(selectedTags)); sessionStorage.setItem("selectedVectorStores", JSON.stringify(selectedVectorStores)); diff --git a/ui/litellm-dashboard/src/utils/secureStorage.ts b/ui/litellm-dashboard/src/utils/secureStorage.ts index 6942368bcf2..183b572e737 100644 --- a/ui/litellm-dashboard/src/utils/secureStorage.ts +++ b/ui/litellm-dashboard/src/utils/secureStorage.ts @@ -18,11 +18,7 @@ function decode(encoded: string): string { } export function setSecureItem(key: string, value: string): void { - try { - window.sessionStorage.setItem(key, encode(value)); - } catch { - // Storage full or unavailable — silently ignore. - } + window.sessionStorage.setItem(key, encode(value)); } export function getSecureItem(key: string): string | null {