MCPcopy Create free account
hub / github.com/pingdotgg/t3code / getThreadSortTimestamp

Function getThreadSortTimestamp

packages/client-runtime/src/state/threadSort.ts:57–67  ·  view source on GitHub ↗
(
  thread: ThreadSortInput,
  sortOrder: SidebarThreadSortOrder | Exclude<SidebarProjectSortOrder, "manual">,
)

Source from the content-addressed store, hash-verified

55}
56
57export function getThreadSortTimestamp(
58 thread: ThreadSortInput,
59 sortOrder: SidebarThreadSortOrder | Exclude<SidebarProjectSortOrder, "manual">,
60): number {
61 if (sortOrder === "created_at") {
62 return (
63 getFirstSortableTimestamp(thread.createdAt, thread.updatedAt) ?? Number.NEGATIVE_INFINITY
64 );
65 }
66 return getLatestUserMessageTimestamp(thread);
67}
68
69export function sortThreads<T extends { readonly id: string } & ThreadSortInput>(
70 threads: readonly T[],

Callers 3

getProjectSortTimestampFunction · 0.90
sortThreadsFunction · 0.85
groupSortTimestampFunction · 0.85

Calls 2

Tested by

no test coverage detected