解决lint问题

This commit is contained in:
xintaofei
2026-03-12 21:08:59 +08:00
parent c8f6f87ea5
commit 8989f0fffb
3 changed files with 11 additions and 16 deletions

View File

@@ -532,6 +532,7 @@ const ConversationTabView = memo(function ConversationTabView({
refreshConversations, refreshConversations,
selectedAgent, selectedAgent,
setExternalId, setExternalId,
setPendingCleanup,
setSyncState, setSyncState,
sharedT, sharedT,
tWelcome, tWelcome,
@@ -818,7 +819,9 @@ export function ConversationDetailPanel() {
// Update conversation status — use the DB summary (found by // Update conversation status — use the DB summary (found by
// external_id above) since matchedConversationId may be a virtual // external_id above) since matchedConversationId may be a virtual
// (negative) ID that won't match any DB record. // (negative) ID that won't match any DB record.
const dbId = summary?.id ?? (matchedConversationId > 0 ? matchedConversationId : null) const dbId =
summary?.id ??
(matchedConversationId > 0 ? matchedConversationId : null)
if (dbId && (!summary || summary.status === "in_progress")) { if (dbId && (!summary || summary.status === "in_progress")) {
updateConversationStatus(dbId, "pending_review") updateConversationStatus(dbId, "pending_review")
.then(() => refreshConversations()) .then(() => refreshConversations())

View File

@@ -270,8 +270,7 @@ function reducer(
// DB data is authoritative for completed turns — always clear localTurns. // DB data is authoritative for completed turns — always clear localTurns.
// Only preserve optimisticTurns + liveMessage if user actively sent // Only preserve optimisticTurns + liveMessage if user actively sent
// a message and is awaiting agent response. // a message and is awaiting agent response.
const isActivelyInteracting = const isActivelyInteracting = current.syncState === "awaiting_persist"
current.syncState === "awaiting_persist"
const nextSession: ConversationRuntimeSession = { const nextSession: ConversationRuntimeSession = {
...current, ...current,
@@ -358,8 +357,7 @@ function reducer(
// Also block during cold loading (detailLoading) — the reconnect // Also block during cold loading (detailLoading) — the reconnect
// liveMessage arrives before DB data, causing overlap after fetch. // liveMessage arrives before DB data, causing overlap after fetch.
const hasExistingTurns = const hasExistingTurns =
(session.detail?.turns.length ?? 0) > 0 || (session.detail?.turns.length ?? 0) > 0 || session.localTurns.length > 0
session.localTurns.length > 0
if ( if (
action.liveMessage !== null && action.liveMessage !== null &&
session.liveMessage === null && session.liveMessage === null &&
@@ -559,6 +557,7 @@ export function ConversationRuntimeProvider({
const [state, dispatch] = useReducer(reducer, initialState) const [state, dispatch] = useReducer(reducer, initialState)
const stateRef = useRef(state) const stateRef = useRef(state)
// eslint-disable-next-line react-hooks/refs -- stateRef is only read in callbacks, not during render
stateRef.current = state stateRef.current = state
const getSession = useCallback( const getSession = useCallback(
@@ -681,16 +680,14 @@ export function ConversationRuntimeProvider({
const delay = attempt === 0 ? 1500 : 3000 const delay = attempt === 0 ? 1500 : 3000
timerId = setTimeout(() => { timerId = setTimeout(() => {
if (cancelled) return if (cancelled) return
const session = const session = stateRef.current.byConversationId.get(runtimeId)
stateRef.current.byConversationId.get(runtimeId)
if (!session || session.localTurns.length === 0) return if (!session || session.localTurns.length === 0) return
if (session.syncState === "awaiting_persist") return if (session.syncState === "awaiting_persist") return
getFolderConversation(dbConversationId) getFolderConversation(dbConversationId)
.then((parsed) => { .then((parsed) => {
if (cancelled) return if (cancelled) return
const cur = const cur = stateRef.current.byConversationId.get(runtimeId)
stateRef.current.byConversationId.get(runtimeId)
if (!cur || cur.localTurns.length === 0) return if (!cur || cur.localTurns.length === 0) return
if (cur.syncState === "awaiting_persist") return if (cur.syncState === "awaiting_persist") return
@@ -716,10 +713,7 @@ export function ConversationRuntimeProvider({
for (let i = 0; i < localAssistantIndices.length; i++) { for (let i = 0; i < localAssistantIndices.length; i++) {
const parsedIdx = offset + i const parsedIdx = offset + i
if ( if (parsedIdx < 0 || parsedIdx >= parsedAssistantTurns.length)
parsedIdx < 0 ||
parsedIdx >= parsedAssistantTurns.length
)
continue continue
const pt = parsedAssistantTurns[parsedIdx] const pt = parsedAssistantTurns[parsedIdx]
if (!pt.usage && !pt.duration_ms && !pt.model) continue if (!pt.usage && !pt.duration_ms && !pt.model) continue

View File

@@ -31,9 +31,7 @@ export function useConversationDetail(conversationId: number): {
return { return {
detail: session?.detail ?? null, detail: session?.detail ?? null,
loading: session loading: session ? session.detailLoading : !isVirtual,
? session.detailLoading
: !isVirtual,
error: session?.detailError ?? null, error: session?.detailError ?? null,
} }
} }