Skip to content

Commit

Permalink
fix: make it clearer when capture is before PH init
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Feb 14, 2024
1 parent f2b8462 commit b82d8a0
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export function ItemPerformanceEvent({
<HeadersDisplay
request={item.request_headers}
response={item.response_headers}
isInitial={item.is_initial}
/>
),
},
Expand All @@ -374,7 +375,11 @@ export function ItemPerformanceEvent({
<BodyDisplay
content={item.request_body}
headers={item.request_headers}
emptyMessage="No request body captured"
emptyMessage={
item.is_initial
? 'captured before PostHog was initialized'
: 'No request body captured'
}
/>
),
},
Expand All @@ -386,7 +391,11 @@ export function ItemPerformanceEvent({
<BodyDisplay
content={item.response_body}
headers={item.response_headers}
emptyMessage="No response body captured"
emptyMessage={
item.is_initial
? 'captured before PostHog was initialized'
: 'No response body captured'
}
/>
),
}
Expand Down Expand Up @@ -457,20 +466,23 @@ function BodyDisplay({
function HeadersDisplay({
request,
response,
isInitial,
}: {
request: Record<string, string> | undefined
response: Record<string, string> | undefined
isInitial?: boolean
}): JSX.Element | null {
const emptyMessage = isInitial ? 'captured before PostHog was initialized' : 'No headers captured'
return (
<div className="flex flex-col w-full">
<div>
<h4 className="font-semibold">Request Headers</h4>
<SimpleKeyValueList item={request || {}} emptyMessage="No headers captured" />
<SimpleKeyValueList item={request || {}} emptyMessage={emptyMessage} />
</div>
<LemonDivider dashed />
<div>
<h4 className="font-semibold">Response Headers</h4>
<SimpleKeyValueList item={response || {}} emptyMessage="No headers captured" />
<SimpleKeyValueList item={response || {}} emptyMessage={emptyMessage} />
</div>
</div>
)
Expand Down

0 comments on commit b82d8a0

Please sign in to comment.