From ca86bfc4270e60ba0f6b43b313796fc6ec08a1ed Mon Sep 17 00:00:00 2001 From: hypercross Date: Tue, 28 Apr 2026 15:50:00 +0800 Subject: [PATCH] refactor: use effect for assignSelector in BaseGameClient Replace subscribe with effect in assignSelector to ensure the selector value is tracked and the callback is executed within the reactive context. --- src/core/game-client.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/game-client.ts b/src/core/game-client.ts index efae3f5..cef1575 100644 --- a/src/core/game-client.ts +++ b/src/core/game-client.ts @@ -60,7 +60,9 @@ export abstract class BaseGameClient< assignSelector(selector: (t: T) => S, callback: (s: S) => void) { const selected = computed(() => selector(this._context.value)); - return selected.subscribe(callback); + return effect(() => { + callback(selected.value); + }); } addInterruption() {