Created
November 16, 2023 01:36
-
-
Save jasonLaster/dbc36998cc20a93b01d738f75a3de5c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/packages/shared/client/ReplayClient.ts b/packages/shared/client/ReplayClient.ts | |
index e22631c97..d413f3ef8 100644 | |
--- a/packages/shared/client/ReplayClient.ts | |
+++ b/packages/shared/client/ReplayClient.ts | |
@@ -54,6 +54,7 @@ import { | |
getDocumentResult, | |
getEventListenersResult, | |
getExceptionValueResult, | |
+ getObjectPreviewParameters, | |
getParentNodesResult, | |
getScopeResult, | |
getTopFrameResult, | |
@@ -102,6 +103,8 @@ export class ReplayClient implements ReplayClientInterface { | |
private _processingProgress: number | null = null; | |
private _recordingId: RecordingId | null = null; | |
private _sessionId: SessionId | null = null; | |
+ private _queuedGetObjectPropertyRequests: Map<PauseId, any[]> = [] | |
+ private _pendingGetObjectPropertyRequests: Map<PauseId, any[]> = new Map() | |
private sessionWaiter = defer<SessionId>(); | |
@@ -684,21 +687,42 @@ export class ReplayClient implements ReplayClientInterface { | |
return steps; | |
} | |
+ private async queuGetObjectProperty(params: any, pauseId: string) { | |
+ const deferred = defer() | |
+ | |
+ const queuedRequests = this._queuedGetObjectPropertyRequests.has(pauseId) ? this._queuedGetObjectPropertyRequests.get(pauseId) : [] | |
+ this._queuedGetObjectPropertyRequests.set(pauseId, queuedRequests.push(params)) | |
+ | |
+ const pendingPromisesRequests = this._pendingGetObjectPropertyRequests.has(pauseId) ? this._pendingGetObjectPropertyRequests.get(pauseId) : []; | |
+ | |
+ | |
+ this._pendingGetObjectPropertyRequests.set(pauseId, pendingPromisesRequests.push(deferred)) | |
+ | |
+ this.flushGetObjectProperties(); | |
+ return deferred.promise; | |
+ } | |
+ | |
+ flushGetObjectPropeties = debounce(async (queuedGetObjectPropertyRequests, pauseId) => { | |
+ const { results } = client.Pause.getObjectPreviews(queuedGetObjectPropertyRequests, this._sessionId) | |
+ this._pendingGetObjectPropertyRequests.get(pauseId).map(({ resolve }, index) => resolve(results[index])) | |
+ }, 100) | |
+ | |
async getObjectProperty( | |
objectId: ObjectId, | |
pauseId: PauseId, | |
propertyName: string | |
): Promise<Result> { | |
const sessionId = this.getSessionIdThrows(); | |
- const { result } = await client.Pause.getObjectProperty( | |
+ | |
+ const promise = await this.queuGetObjectProperty( | |
{ | |
object: objectId, | |
name: propertyName, | |
}, | |
- sessionId, | |
pauseId | |
); | |
- return result; | |
+ | |
+ return promise; | |
} | |
async getObjectWithPreview( | |
diff --git a/src/ui/components/Library/Team/View/Tests/Overview/TestOverviewContent.tsx b/src/ui/components/Library/Team/View/Tests/Overview/TestOverviewContent.tsx | |
index 16769ffea..cc700ed6d 100644 | |
--- a/src/ui/components/Library/Team/View/Tests/Overview/TestOverviewContent.tsx | |
+++ b/src/ui/components/Library/Team/View/Tests/Overview/TestOverviewContent.tsx | |
@@ -55,7 +55,10 @@ function ErrorFrequency({ | |
const sortedPassing = orderBy(passing, "createdAt", "desc"); | |
// ${isSelected ? styles.libraryRowSelected : ""} | |
- | |
+ console.log( | |
+ "errors", | |
+ Object.entries(errorFrequency).map(e => e[0]) | |
+ ); | |
return ( | |
<div> | |
<div className="border-b border-themeBorder py-2 px-4"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment