瀏覽代碼

Fix status indicator not syncing when switching tables

Reset isConnected and isBackendConnected to false when switching tables
so the header status indicator shows the transitional state until the
new table's WebSocket connection reports its actual status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 2 周之前
父節點
當前提交
da7b895e92
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      frontend/src/components/layout/Layout.tsx

+ 2 - 0
frontend/src/components/layout/Layout.tsx

@@ -283,6 +283,8 @@ export function Layout() {
     const unsubscribe = apiClient.onBaseUrlChange(() => {
     const unsubscribe = apiClient.onBaseUrlChange(() => {
       if (isMounted) {
       if (isMounted) {
         wasPlayingRef.current = null // Reset playing state for new table
         wasPlayingRef.current = null // Reset playing state for new table
+        setIsConnected(false) // Reset connection status until new table reports
+        setIsBackendConnected(false) // Show connecting state
         connectWebSocket()
         connectWebSocket()
       }
       }
     })
     })