From e01fd8d50c36e3c0b26f6839feb22a97928b75fc Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Fri, 17 Jan 2025 08:34:19 +0000 Subject: [PATCH] fix: handle undefined websocket in context --- app/utils/ws-agent.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/utils/ws-agent.ts b/app/utils/ws-agent.ts index cea469e..178b723 100644 --- a/app/utils/ws-agent.ts +++ b/app/utils/ws-agent.ts @@ -86,6 +86,10 @@ export async function initAgentCache(defaultTTL: number, filepath: string) { let agentSocket: WebSocket | undefined; export function initAgentSocket(context: LoaderFunctionArgs['context']) { + if (!context.ws) { + return; + }; + const client = context.ws.clients.values().next().value; agentSocket = client; }