perf(editor): Improve performance of the new logs view (#14861)

This commit is contained in:
Suguru Inoue
2025-04-25 10:45:33 +02:00
committed by GitHub
parent cdf421e80f
commit 40aadbf880
6 changed files with 111 additions and 66 deletions

View File

@@ -457,3 +457,19 @@ export function deepToRaw<T>(sourceObj: T): T {
return objectIterator(sourceObj);
}
export function flattenLogEntries(
entries: LogEntry[],
collapsedEntryIds: Record<string, boolean>,
ret: LogEntry[] = [],
): LogEntry[] {
for (const entry of entries) {
ret.push(entry);
if (!collapsedEntryIds[entry.id]) {
flattenLogEntries(entry.children, collapsedEntryIds, ret);
}
}
return ret;
}