修复右侧边栏diff区不实时显示修改文件

This commit is contained in:
xintaofei
2026-03-12 23:45:03 +08:00
parent a1d5a237e5
commit 0c54900396
3 changed files with 55 additions and 6 deletions

View File

@@ -137,7 +137,7 @@ const ConversationTabView = memo(function ConversationTabView({
const tWelcome = useTranslations("Folder.chat.welcomeInputPanel")
const sharedT = useTranslations("Folder.chat.shared")
const { folder, folderId, refreshConversations } = useFolderContext()
const { bindConversationTab } = useTabContext()
const { bindConversationTab, setTabRuntimeConversationId } = useTabContext()
const { setSessionStats } = useSessionStats()
const {
appendOptimisticTurn,
@@ -177,6 +177,19 @@ const ConversationTabView = memo(function ConversationTabView({
const canAutoConnect =
hasPersistedConversation || (agentsLoaded && usableAgentCount > 0)
// Expose the runtime session key to the tab so the aux panel (Diff sidebar)
// can look up live turns even before the DB conversation is created.
useEffect(() => {
if (effectiveConversationId !== conversationId) {
setTabRuntimeConversationId(tabId, effectiveConversationId)
}
}, [
tabId,
effectiveConversationId,
conversationId,
setTabRuntimeConversationId,
])
// Clear pendingCleanup when tab is (re)opened
useEffect(() => {
setPendingCleanup(effectiveConversationId, false)
@@ -544,7 +557,13 @@ const ConversationTabView = memo(function ConversationTabView({
}
setCreatedConversationId(newConversationId)
bindConversationTab(tabId, newConversationId, selectedAgent, title)
bindConversationTab(
tabId,
newConversationId,
selectedAgent,
title,
effectiveConversationId
)
moveMessageInputDraft(
buildNewConversationDraftStorageKey({ folderId }),
buildConversationDraftStorageKey(selectedAgent, newConversationId)

View File

@@ -265,7 +265,8 @@ export function SessionFilesTab() {
const { tabs, activeTabId } = useTabContext()
const activeTab = tabs.find((t) => t.id === activeTabId)
const conversationId = activeTab?.conversationId
const conversationId =
activeTab?.runtimeConversationId ?? activeTab?.conversationId
if (!activeTab) {
return (