fix: refresh git changes after chat revert
Updates Git and Diff views after reverting a chat turn Uses the existing git refresh hint path
This commit is contained in:
@@ -15,6 +15,7 @@ import { registerSessionDirectory } from "./sync-refs"
|
||||
import { isSyntheticPart } from "@/lib/messages/synthetic"
|
||||
import { materializeSessionSnapshots } from "./materialization"
|
||||
import { stripMessageDiffSnapshots } from "./sanitize"
|
||||
import { sessionEvents } from "@/lib/sessionEvents"
|
||||
|
||||
const MESSAGE_REFETCH_LIMIT = 200
|
||||
const MESSAGE_REFETCH_SKIP_PARTS = new Set(["patch", "step-start", "step-finish"])
|
||||
@@ -648,7 +649,8 @@ export async function revertToMessage(sessionId: string, messageId: string): Pro
|
||||
|
||||
// Call SDK and merge authoritative result into store
|
||||
try {
|
||||
const result = await sdk().session.revert({ sessionID: sessionId, directory: dir(), messageID: messageId })
|
||||
const directory = dir()
|
||||
const result = await sdk().session.revert({ sessionID: sessionId, directory, messageID: messageId })
|
||||
if (result.data) {
|
||||
const current = store.getState()
|
||||
const updated = [...current.session]
|
||||
@@ -658,6 +660,9 @@ export async function revertToMessage(sessionId: string, messageId: string): Pro
|
||||
store.setState({ session: updated })
|
||||
}
|
||||
}
|
||||
if (directory) {
|
||||
sessionEvents.requestGitRefresh({ directory })
|
||||
}
|
||||
} catch (err) {
|
||||
// Rollback: restore removed messages + revert marker
|
||||
const current = store.getState()
|
||||
|
||||
Reference in New Issue
Block a user