Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created November 16, 2023 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/dbc36998cc20a93b01d738f75a3de5c8 to your computer and use it in GitHub Desktop.
Save jasonLaster/dbc36998cc20a93b01d738f75a3de5c8 to your computer and use it in GitHub Desktop.
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