mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Clarify thread catalog promotion semantics
This commit is contained in:
parent
d0f37a2cae
commit
fb8f4eee91
1 changed files with 3 additions and 3 deletions
|
|
@ -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];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue