From b3a6d74f1e8aa76166c492e5c8c17ee96b5861f0 Mon Sep 17 00:00:00 2001 From: backuppc Date: Tue, 20 Jan 2026 15:21:23 +0900 Subject: [PATCH] =?UTF-8?q?`localRef`=EC=99=80=20`remoteRef`=EB=A5=BC=20?= =?UTF-8?q?=EB=8F=84=EC=9E=85=ED=95=98=EC=97=AC=20WebSocket=20=EB=AA=85?= =?UTF-8?q?=EB=A0=B9=EC=9D=B4=20=ED=95=AD=EC=83=81=20=EC=B5=9C=EC=8B=A0=20?= =?UTF-8?q?`local`=20=EB=B0=8F=20`remote`=20=EC=83=81=ED=83=9C=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20=ED=95=A9?= =?UTF-8?q?=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/App.tsx b/App.tsx index dd8f7bc..0ea36d1 100644 --- a/App.tsx +++ b/App.tsx @@ -62,6 +62,8 @@ const App: React.FC = () => { // WebSocket const wsRef = useRef(null); const connectionRef = useRef(connection); + const localRef = useRef(local); + const remoteRef = useRef(remote); // --- Helpers --- const addLog = useCallback((type: LogEntry['type'], message: string) => { @@ -101,7 +103,9 @@ const App: React.FC = () => { // Sync connection state to ref for WS callbacks useEffect(() => { connectionRef.current = connection; - }, [connection]); + localRef.current = local; + remoteRef.current = remote; + }, [connection, local, remote]); // --- WebSocket Setup --- useEffect(() => { @@ -264,9 +268,9 @@ const App: React.FC = () => { case 'success': addLog('success', data.message); if (connectionRef.current.connected) { - ws?.send(JSON.stringify({ command: 'LIST', path: remote.path })); + ws?.send(JSON.stringify({ command: 'LIST', path: remoteRef.current.path })); } - ws?.send(JSON.stringify({ command: 'LOCAL_LIST', path: local.path })); + ws?.send(JSON.stringify({ command: 'LOCAL_LIST', path: localRef.current.path })); break; case 'sites_list': @@ -295,9 +299,9 @@ const App: React.FC = () => { addLog('success', data.message); // Refresh lists if (data.path) { - ws?.send(JSON.stringify({ command: 'LOCAL_LIST', path: local.path })); + ws?.send(JSON.stringify({ command: 'LOCAL_LIST', path: localRef.current.path })); if (connectionRef.current.connected) { - ws?.send(JSON.stringify({ command: 'LIST', path: remote.path })); + ws?.send(JSON.stringify({ command: 'LIST', path: remoteRef.current.path })); } } break;