From e6020b9c277e47ab00bc5d60845704559c423ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Mon, 17 Jun 2024 13:18:32 +0200 Subject: [PATCH] feat(ws-client): allow change reactive for state, filesMap and idMap (#5906) --- packages/ws-client/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ws-client/src/index.ts b/packages/ws-client/src/index.ts index 115f6a27f2c6..99d7ae3576f0 100644 --- a/packages/ws-client/src/index.ts +++ b/packages/ws-client/src/index.ts @@ -14,7 +14,7 @@ export interface VitestClientOptions { reconnectInterval?: number reconnectTries?: number connectTimeout?: number - reactive?: (v: T) => T + reactive?: (v: T, forKey: 'state' | 'idMap' | 'filesMap') => T ref?: (v: T) => { value: T } WebSocketConstructor?: typeof WebSocket } @@ -44,10 +44,10 @@ export function createClient(url: string, options: VitestClientOptions = {}) { state: new StateManager(), waitForConnection, reconnect, - }) as VitestClient + }, 'state') as VitestClient - ctx.state.filesMap = reactive(ctx.state.filesMap) - ctx.state.idMap = reactive(ctx.state.idMap) + ctx.state.filesMap = reactive(ctx.state.filesMap, 'filesMap') + ctx.state.idMap = reactive(ctx.state.idMap, 'idMap') let onMessage: Function const functions: WebSocketEvents = {