diff --git a/webview-ui/src/App.tsx b/webview-ui/src/App.tsx index 3980f38cc8..3ae441cd52 100644 --- a/webview-ui/src/App.tsx +++ b/webview-ui/src/App.tsx @@ -28,16 +28,13 @@ const App = () => { const [tab, setTab] = useState("chat") const settingsRef = useRef(null) - const switchTab = useCallback( - (newTab: Tab) => { - if (tab === "settings" && settingsRef.current?.checkUnsaveChanges) { - settingsRef.current.checkUnsaveChanges(() => setTab(newTab)) - } else { - setTab(newTab) - } - }, - [tab], - ) + const switchTab = useCallback((newTab: Tab) => { + if (settingsRef.current?.checkUnsaveChanges) { + settingsRef.current.checkUnsaveChanges(() => setTab(newTab)) + } else { + setTab(newTab) + } + }, []) const onMessage = useCallback( (e: MessageEvent) => { @@ -73,7 +70,7 @@ const App = () => { ) : ( <> - {tab === "settings" && switchTab("chat")} />} + {tab === "settings" && setTab("chat")} />} {tab === "history" && switchTab("chat")} />} {tab === "mcp" && switchTab("chat")} />} {tab === "prompts" && switchTab("chat")} />}