Skip to content

Commit abb96a3

Browse files
committed
fix(web):修复频繁的todo的toast报警提示
1 parent 86823fd commit abb96a3

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

web/src/utils/eventBridge.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,29 @@ describe("eventBridge", () => {
925925
expect(useUIStore.getState().toasts).toHaveLength(0);
926926
});
927927

928+
it("TodoConflict invalid_transition does NOT show toast", () => {
929+
const api = createMockGatewayAPI();
930+
handleGatewayEvent(
931+
{
932+
type: EventType.TodoConflict,
933+
payload: {
934+
payload: {
935+
runtime_event_type: EventType.TodoConflict,
936+
payload: { action: "update", reason: "invalid_transition" },
937+
},
938+
},
939+
session_id: "sess-1",
940+
run_id: "run-1",
941+
},
942+
api,
943+
);
944+
945+
expect(useRuntimeInsightStore.getState().todoConflict?.reason).toBe(
946+
"invalid_transition",
947+
);
948+
expect(useUIStore.getState().toasts).toHaveLength(0);
949+
});
950+
928951
it("TodoConflict invalid_arguments shows info toast", () => {
929952
const api = createMockGatewayAPI();
930953
handleGatewayEvent(

web/src/utils/eventBridge.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,13 @@ export function handleGatewayEvent(
982982
const payload = eventPayload as TodoEventPayload | undefined;
983983
if (payload) insightStore.setTodoConflict(payload);
984984
const reason = strField(eventPayload, "reason");
985-
// revision_conflict 是可恢复冲突,仅在面板显示,不弹全局 toast;
985+
// revision_conflict 与 invalid_transition 是可恢复冲突,仅在面板显示,不弹全局 toast;
986986
// 其余冲突降级为 info 避免打断聊天体验。
987-
if (reason && reason !== "revision_conflict") {
987+
if (
988+
reason &&
989+
reason !== "revision_conflict" &&
990+
reason !== "invalid_transition"
991+
) {
988992
uiStore.showToast(`Todo conflict: ${reason}`, "info");
989993
}
990994
break;

0 commit comments

Comments
 (0)