补齐 AGC 错误通知重载恢复
挂载时读取 Rust 错误快照并恢复未通知事件 提交报告时移除 Rust 内部 notified 字段
This commit is contained in:
@@ -16,15 +16,23 @@ export function ErrorReportNotice() {
|
||||
const loadEvents = useCallback(async (eventIds?: string[]) => {
|
||||
try {
|
||||
const events = await getPendingClientErrorEvents();
|
||||
if (!eventIds?.length) return;
|
||||
if (eventIds?.length) {
|
||||
const ids = new Set(eventIds);
|
||||
setNotificationEvents(events.filter((event) => ids.has(event.eventId)));
|
||||
} else {
|
||||
setNotificationEvents(
|
||||
events.filter((event) => event.notified === false),
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
// 通知失败不应打断 AGC 主流程。
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => subscribeClientErrorEvents(loadEvents), [loadEvents]);
|
||||
useEffect(() => {
|
||||
void loadEvents();
|
||||
return subscribeClientErrorEvents(loadEvents);
|
||||
}, [loadEvents]);
|
||||
|
||||
const openReport = () => {
|
||||
setReportEvents(notificationEvents);
|
||||
|
||||
@@ -17,6 +17,7 @@ export type ClientErrorEvent = {
|
||||
stack?: string;
|
||||
occurredAt: string;
|
||||
count: number;
|
||||
notified?: boolean;
|
||||
};
|
||||
|
||||
export type DiagnosticLogFile = { name: string; content: string };
|
||||
@@ -181,7 +182,9 @@ export async function submitErrorReportBatch(
|
||||
schemaVersion: 1,
|
||||
submissionId:
|
||||
globalThis.crypto?.randomUUID?.() ?? `submission-${Date.now()}`,
|
||||
events: payload.events,
|
||||
events: payload.events.map(
|
||||
({ notified: _notified, ...event }) => event,
|
||||
),
|
||||
userDescription: payload.userDescription?.trim() || null,
|
||||
logs: payload.logs,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user