From c96f8a0cada0044bc4ba4f42a101ff699bc96cb1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 3 Mar 2026 05:59:50 +0000 Subject: [PATCH] fix(ui): persist selected model across playground navigation Read selectedModel from sessionStorage on initialization so the model selection survives navigating away from and back to the playground page. The value was already being saved to sessionStorage on change but never restored on mount. Co-authored-by: Ishaan Jaff --- .../src/components/playground/chat_ui/ChatUI.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 80e25f18cce..5156739f465 100644 --- a/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx +++ b/ui/litellm-dashboard/src/components/playground/chat_ui/ChatUI.tsx @@ -157,7 +157,10 @@ const ChatUI: React.FC = ({ return []; } }); - const [selectedModel, setSelectedModel] = useState(simplified ? fixedModel : undefined); + const [selectedModel, setSelectedModel] = useState(() => { + if (simplified) return fixedModel; + return sessionStorage.getItem("selectedModel") || undefined; + }); const [showCustomModelInput, setShowCustomModelInput] = useState(false); const [modelInfo, setModelInfo] = useState([]); const [agentInfo, setAgentInfo] = useState([]);