mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 17:30:31 +00:00
Deduplicate active thread clearing
This commit is contained in:
parent
ad3ce85884
commit
16f73703e7
1 changed files with 7 additions and 9 deletions
|
|
@ -578,16 +578,10 @@ export class CodexChatView extends ItemView {
|
|||
async startNewThread(): Promise<void> {
|
||||
if (this.turnBusy) return;
|
||||
|
||||
this.invalidateResumeWork();
|
||||
this.clearRestoredThreadLifecycle();
|
||||
this.clearDeferredRestoredThreadHydration();
|
||||
this.chatState.dispatch({ type: "thread/active-cleared" });
|
||||
this.threadRename.resetThreadTurnPresence(false);
|
||||
this.clearActiveThreadContext();
|
||||
this.chatState.dispatch({ type: "ui/panel-set", panel: null });
|
||||
this.setStatus("New chat.");
|
||||
this.queueMessagesBottomScroll();
|
||||
this.plugin.refreshThreadsViewLiveState();
|
||||
this.notifyActiveThreadIdentityChanged();
|
||||
this.render();
|
||||
this.focusComposer();
|
||||
}
|
||||
|
|
@ -1402,8 +1396,7 @@ export class CodexChatView extends ItemView {
|
|||
this.render();
|
||||
}
|
||||
|
||||
private clearArchivedActiveThread(threadId: string): boolean {
|
||||
if (this.state.activeThreadId !== threadId) return false;
|
||||
private clearActiveThreadContext(): void {
|
||||
this.invalidateResumeWork();
|
||||
this.clearRestoredThreadLifecycle();
|
||||
this.clearDeferredRestoredThreadHydration();
|
||||
|
|
@ -1411,6 +1404,11 @@ export class CodexChatView extends ItemView {
|
|||
this.threadRename.resetThreadTurnPresence(false);
|
||||
this.notifyActiveThreadIdentityChanged();
|
||||
this.plugin.refreshThreadsViewLiveState();
|
||||
}
|
||||
|
||||
private clearArchivedActiveThread(threadId: string): boolean {
|
||||
if (this.state.activeThreadId !== threadId) return false;
|
||||
this.clearActiveThreadContext();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue