fix: use custom event for training panel toggle, no more poll inference
SkillInsertDialog dispatches SKILL_TOGGLED_EVENT on user click. AssistantWorkspace listens for that event to set applied state. Completely eliminates poll-based state inference that caused flash. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,7 @@ import {
|
||||
} from "@/lib/claw-active-session";
|
||||
import { useClawSessionReplay } from "@/lib/claw-session-replay";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { dispatchSkillToggled } from "@/lib/use-training-mode";
|
||||
|
||||
type ComposerInsertEvent = CustomEvent<{ text: string }>;
|
||||
|
||||
@@ -1800,6 +1801,7 @@ function SkillInsertDialog() {
|
||||
);
|
||||
}
|
||||
setSkills(payload);
|
||||
dispatchSkillToggled({ skill: skill.name, enabled });
|
||||
setStatus(enabled ? `已启用 ${skill.name}` : `已停用 ${skill.name}`);
|
||||
} catch (err) {
|
||||
setSkills(previous);
|
||||
|
||||
Reference in New Issue
Block a user