Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InspectableTimestampedPointContext to TestEventDetails #9813

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { TimeStampedPoint } from "@replayio/protocol";
import { useCallback, useContext, useEffect, useRef, useState } from "react";
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { STATUS_PENDING, useImperativeCacheValue } from "suspense";

import ErrorBoundary from "replay-next/components/ErrorBoundary";
import PropertiesRenderer from "replay-next/components/inspector/PropertiesRenderer";
import { SyntaxHighlighter } from "replay-next/components/SyntaxHighlighter/SyntaxHighlighter";
import { InspectableTimestampedPointContext } from "replay-next/src/contexts/InspectorContext";
import { SessionContext } from "replay-next/src/contexts/SessionContext";
import { ParsedToken, parsedTokensToHtml } from "replay-next/src/utils/syntax-parser";
import { ReplayClientContext } from "shared/client/ReplayClientContext";
Expand Down Expand Up @@ -62,6 +63,14 @@ function UserActionEventDetails({
variable
);

const context = useMemo(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ is there even any reason to memoize this? Why not just pass value={timeStampedPoint} directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is necessary because TimeStampedPoint has a point property but InspectableTimestampedPointContext expects an executionPoint property.

() => ({
executionPoint: timeStampedPoint.point,
time: timeStampedPoint.time,
}),
[timeStampedPoint]
);

if (status === STATUS_PENDING) {
return <LoadingInProgress />;
} else if (value?.props == null || value?.pauseId == null) {
Expand All @@ -70,7 +79,9 @@ function UserActionEventDetails({

return (
<div className={styles.UserActionEventDetails} data-test-name="UserActionEventDetails">
<PropertiesRenderer pauseId={value.pauseId} object={value.props} />
<InspectableTimestampedPointContext.Provider value={context}>
<PropertiesRenderer pauseId={value.pauseId} object={value.props} />
</InspectableTimestampedPointContext.Provider>
</div>
);
}
Expand Down