mirror of
https://github.com/tale/headplane.git
synced 2026-08-29 08:27:08 +00:00
fix: handle undefined websocket in context
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user