Quellcode durchsuchen

Remove debug logging from multi-table fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris vor 2 Wochen
Ursprung
Commit
a8577fd408
2 geänderte Dateien mit 6 neuen und 22 gelöschten Zeilen
  1. 2 13
      frontend/src/contexts/TableContext.tsx
  2. 4 9
      frontend/src/lib/apiClient.ts

+ 2 - 13
frontend/src/contexts/TableContext.tsx

@@ -90,19 +90,8 @@ export function TableProvider({ children }: { children: React.ReactNode }) {
             setActiveTableState(active)
             setActiveTableState(active)
             // Set base URL for remote tables (tables not on the current origin)
             // Set base URL for remote tables (tables not on the current origin)
             // Use normalized URL comparison to handle port differences (e.g., :80 vs no port)
             // Use normalized URL comparison to handle port differences (e.g., :80 vs no port)
-            // Don't rely on isCurrent flag as it may be stale from localStorage
-            const normalizedActiveUrl = normalizeUrlOrigin(active.url)
-            const currentOrigin = window.location.origin
-            const isRemoteTable = normalizedActiveUrl !== currentOrigin
-            console.log('[TableContext] Restoring active table:', {
-              activeId,
-              activeUrl: active.url,
-              normalizedActiveUrl,
-              currentOrigin,
-              isRemoteTable,
-              willSetBaseUrl: isRemoteTable,
-            })
-            if (isRemoteTable) {
+            // Note: apiClient pre-initializes from localStorage, but this ensures consistency
+            if (normalizeUrlOrigin(active.url) !== window.location.origin) {
               apiClient.setBaseUrl(active.url)
               apiClient.setBaseUrl(active.url)
             }
             }
           }
           }

+ 4 - 9
frontend/src/lib/apiClient.ts

@@ -35,7 +35,6 @@ class ApiClient {
     const newUrl = url.replace(/\/$/, '')
     const newUrl = url.replace(/\/$/, '')
     // Only notify if the URL actually changed
     // Only notify if the URL actually changed
     if (newUrl === this._baseUrl) return
     if (newUrl === this._baseUrl) return
-    console.log('[ApiClient] setBaseUrl:', { from: this._baseUrl || '(empty)', to: newUrl || '(empty)' })
     this._baseUrl = newUrl
     this._baseUrl = newUrl
     // Notify listeners
     // Notify listeners
     this._listeners.forEach(listener => listener(this._baseUrl))
     this._listeners.forEach(listener => listener(this._baseUrl))
@@ -132,12 +131,11 @@ class ApiClient {
     // Ensure endpoint starts with /
     // Ensure endpoint starts with /
     const path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`
     const path = endpoint.startsWith('/') ? endpoint : `/${endpoint}`
 
 
-    let wsUrl: string
     if (this._baseUrl) {
     if (this._baseUrl) {
       // Parse the base URL to get host
       // Parse the base URL to get host
       const url = new URL(this._baseUrl)
       const url = new URL(this._baseUrl)
       const protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
       const protocol = url.protocol === 'https:' ? 'wss:' : 'ws:'
-      wsUrl = `${protocol}//${url.host}${path}`
+      return `${protocol}//${url.host}${path}`
     } else {
     } else {
       // Use current page's host for relative URLs
       // Use current page's host for relative URLs
       const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
       const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
@@ -146,10 +144,8 @@ class ApiClient {
       const host = window.location.hostname
       const host = window.location.hostname
       const port = import.meta.env.DEV ? '8080' : window.location.port
       const port = import.meta.env.DEV ? '8080' : window.location.port
       const portSuffix = port ? `:${port}` : ''
       const portSuffix = port ? `:${port}` : ''
-      wsUrl = `${protocol}//${host}${portSuffix}${path}`
+      return `${protocol}//${host}${portSuffix}${path}`
     }
     }
-    console.log('[ApiClient] getWebSocketUrl:', { baseUrl: this._baseUrl || '(empty)', wsUrl })
-    return wsUrl
   }
   }
 
 
   /**
   /**
@@ -236,11 +232,10 @@ function initializeBaseUrlFromStorage(): void {
 
 
     // Only set base URL for remote tables (different origin)
     // Only set base URL for remote tables (different origin)
     if (normalizedActiveUrl !== currentOrigin) {
     if (normalizedActiveUrl !== currentOrigin) {
-      console.log('[ApiClient] Pre-initializing base URL from localStorage:', active.url)
       apiClient.setBaseUrl(active.url)
       apiClient.setBaseUrl(active.url)
     }
     }
-  } catch (e) {
-    console.error('[ApiClient] Failed to pre-initialize base URL:', e)
+  } catch {
+    // Silently fail - TableContext will handle initialization as fallback
   }
   }
 }
 }