Compare commits

...

1 Commits

Author SHA1 Message Date
Guido D'Orsi
2be3d52c94 perf: improve performance of coValue.knownState() 2024-11-22 17:46:09 +01:00

View File

@@ -155,15 +155,16 @@ export class CoValueCore {
/** @internal */
knownStateUncached(): CoValueKnownState {
const sessions: Record<SessionID, number> = {};
for (const [sessionId, sessionLog] of this.sessionLogs) {
sessions[sessionId] = sessionLog.transactions.length;
}
return {
id: this.id,
header: true,
sessions: Object.fromEntries(
[...this.sessionLogs.entries()].map(([k, v]) => [
k,
v.transactions.length,
]),
),
sessions,
};
}