mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 03:30:40 +00:00
fix(cli): stabilize resume callback deps (#3533)
This commit is contained in:
parent
69da115dcf
commit
78037d996b
1 changed files with 8 additions and 4 deletions
|
|
@ -62,9 +62,11 @@ export function useResumeCommand(
|
||||||
const { config, historyManager, startNewSession, setSessionName, remount } =
|
const { config, historyManager, startNewSession, setSessionName, remount } =
|
||||||
options ?? {};
|
options ?? {};
|
||||||
|
|
||||||
|
const hasHistoryManager = !!historyManager;
|
||||||
|
const { clearItems, loadHistory } = historyManager || {};
|
||||||
const handleResume = useCallback(
|
const handleResume = useCallback(
|
||||||
async (sessionId: string) => {
|
async (sessionId: string) => {
|
||||||
if (!config || !historyManager || !startNewSession) {
|
if (!config || !hasHistoryManager || !startNewSession) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,8 +90,8 @@ export function useResumeCommand(
|
||||||
|
|
||||||
// Reset UI history.
|
// Reset UI history.
|
||||||
const uiHistoryItems = buildResumedHistoryItems(sessionData, config);
|
const uiHistoryItems = buildResumedHistoryItems(sessionData, config);
|
||||||
historyManager.clearItems();
|
clearItems?.();
|
||||||
historyManager.loadHistory(uiHistoryItems);
|
loadHistory?.(uiHistoryItems);
|
||||||
|
|
||||||
// Update session history core.
|
// Update session history core.
|
||||||
config.startNewSession(sessionId, sessionData);
|
config.startNewSession(sessionId, sessionData);
|
||||||
|
|
@ -114,7 +116,9 @@ export function useResumeCommand(
|
||||||
[
|
[
|
||||||
closeResumeDialog,
|
closeResumeDialog,
|
||||||
config,
|
config,
|
||||||
historyManager,
|
hasHistoryManager,
|
||||||
|
clearItems,
|
||||||
|
loadHistory,
|
||||||
startNewSession,
|
startNewSession,
|
||||||
setSessionName,
|
setSessionName,
|
||||||
remount,
|
remount,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue