MCPcopy
hub / github.com/codeaashu/claude-code / groupLogsBySessionId

Function groupLogsBySessionId

src/components/LogSelector.tsx:1544–1561  ·  view source on GitHub ↗
(filteredLogs: LogOption[])

Source from the content-addressed store, hash-verified

1542 return fullText.length > DEEP_SEARCH_MAX_TEXT_LENGTH ? fullText.slice(0, DEEP_SEARCH_MAX_TEXT_LENGTH) : fullText;
1543}
1544function groupLogsBySessionId(filteredLogs: LogOption[]): Map<string, LogOption[]> {
1545 const groups = new Map<string, LogOption[]>();
1546 for (const log of filteredLogs) {
1547 const sessionId = getSessionIdFromLog(log);
1548 if (sessionId) {
1549 const existing = groups.get(sessionId);
1550 if (existing) {
1551 existing.push(log);
1552 } else {
1553 groups.set(sessionId, [log]);
1554 }
1555 }
1556 }
1557
1558 // Sort logs within each group by modified date (newest first)
1559 groups.forEach(logs => logs.sort((a, b) => new Date(b.modified).getTime() - new Date(a.modified).getTime()));
1560 return groups;
1561}
1562
1563/**
1564 * Get unique tags from a list of logs, sorted alphabetically

Callers 1

LogSelectorFunction · 0.85

Calls 5

getSessionIdFromLogFunction · 0.85
forEachMethod · 0.80
getMethod · 0.65
pushMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected