From fb8f4eee91a2d82c6fd373bf3ad0158cf14b2c08 Mon Sep 17 00:00:00 2001 From: murashit Date: Sun, 21 Jun 2026 15:55:02 +0900 Subject: [PATCH] Clarify thread catalog promotion semantics --- src/workspace/thread-catalog.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/workspace/thread-catalog.ts b/src/workspace/thread-catalog.ts index de67b64a..c288f00a 100644 --- a/src/workspace/thread-catalog.ts +++ b/src/workspace/thread-catalog.ts @@ -109,7 +109,7 @@ export function createThreadCatalog(options: ThreadCatalogOptions): ThreadCatalo return current ? current.filter((thread) => thread.id !== threadId) : null; }); if (archivedThread) { - options.queries.updateArchivedThreads((current) => upsertThread(current ?? [], { ...archivedThread, archived: true })); + options.queries.updateArchivedThreads((current) => promoteThreadInList(current ?? [], { ...archivedThread, archived: true })); } else { refreshArchivedThreadsAfterUnknownArchive(options.queries); } @@ -127,10 +127,10 @@ export function createThreadCatalog(options: ThreadCatalogOptions): ThreadCatalo } function recordActiveThread(queries: AppServerSharedQueries, thread: Thread): void { - queries.updateActiveThreads((current) => upsertThread(current ?? [], thread)); + queries.updateActiveThreads((current) => promoteThreadInList(current ?? [], thread)); } -function upsertThread(threads: readonly Thread[], thread: Thread): readonly Thread[] { +function promoteThreadInList(threads: readonly Thread[], thread: Thread): readonly Thread[] { const withoutThread = threads.filter((item) => item.id !== thread.id); return [thread, ...withoutThread]; }