'use client'; import { useEffect } from 'react'; import { clientCleanup } from '@/lib/client-connection-cleanup'; // 客戶端連線清理組件 export function ClientConnectionCleanup() { useEffect(() => { // 確保在瀏覽器環境中執行 if (typeof window === 'undefined') return; // 初始化客戶端清理 console.log('🖥️ 客戶端連線清理組件已載入'); // 可以在這裡添加額外的初始化邏輯 const clientId = clientCleanup.getClientId(); console.log('🆔 客戶端 ID:', clientId); // 清理函數(組件卸載時) return () => { console.log('🔄 客戶端連線清理組件卸載'); // 可以在這裡添加清理邏輯 }; }, []); // 這個組件不渲染任何內容 return null; }