fix: handle undefined websocket in context
This commit is contained in:
parent
c9603ba38a
commit
e01fd8d50c
1 changed files with 4 additions and 0 deletions
|
|
@ -86,6 +86,10 @@ export async function initAgentCache(defaultTTL: number, filepath: string) {
|
||||||
|
|
||||||
let agentSocket: WebSocket | undefined;
|
let agentSocket: WebSocket | undefined;
|
||||||
export function initAgentSocket(context: LoaderFunctionArgs['context']) {
|
export function initAgentSocket(context: LoaderFunctionArgs['context']) {
|
||||||
|
if (!context.ws) {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
const client = context.ws.clients.values().next().value;
|
const client = context.ws.clients.values().next().value;
|
||||||
agentSocket = client;
|
agentSocket = client;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue