feat: 添加执行加载状态和全局执行ID去重,优化CLI视图和MCP配置获取

This commit is contained in:
catlog22
2026-02-17 21:01:09 +08:00
parent c588aa69d2
commit 5a937732f4
5 changed files with 136 additions and 23 deletions

View File

@@ -215,6 +215,18 @@ export function CliViewerPage() {
// Auto-add new executions as tabs, distributing across available panes
const addedExecutionsRef = useRef<Set<string>>(new Set());
// FIX-001: Initialize addedExecutionsRef with existing tab executionIds on mount
// This prevents duplicate tabs from being added after page refresh
useEffect(() => {
// Extract executionIds from all existing tabs in all panes
const existingExecutionIds = Object.values(panes).flatMap((pane) =>
pane.tabs.map((tab) => tab.executionId)
);
existingExecutionIds.forEach((id) => addedExecutionsRef.current.add(id));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); // Empty deps - only run once on mount
useEffect(() => {
const paneIds = Object.keys(panes);
if (paneIds.length === 0) return;