Skip to content

Commit

Permalink
fix(hogql): fix recodings in actors response (#20953)
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr authored Mar 18, 2024
1 parent 485fd52 commit 75bbd6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions frontend/src/scenes/trends/persons-modal/PersonsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { capitalizeFirstLetter, isGroupType, midEllipsis, pluralize } from 'lib/utils'
import { useCallback, useState } from 'react'
import React, { useCallback, useState } from 'react'
import { createRoot } from 'react-dom/client'
import { InsightErrorState, InsightValidationError } from 'scenes/insights/EmptyStates'
import { isOtherBreakdown } from 'scenes/insights/utils'
Expand Down Expand Up @@ -406,11 +406,10 @@ export function ActorRow({ actor, onOpenRecording, propertiesTimelineFilter }: A
<ul className="space-y-px">
{matchedRecordings?.length
? matchedRecordings.map((recording, i) => (
<>
<React.Fragment key={i}>
<LemonDivider className="my-0" />
<li key={i}>
<li>
<LemonButton
key={i}
fullWidth
onClick={() => {
recording.session_id &&
Expand All @@ -431,7 +430,7 @@ export function ActorRow({ actor, onOpenRecording, propertiesTimelineFilter }: A
</div>
</LemonButton>
</li>
</>
</React.Fragment>
))
: null}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions posthog/hogql_queries/actors_query_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def determine_strategy(self) -> ActorStrategy:
def get_recordings(self, event_results, recordings_lookup) -> Generator[dict, None, None]:
return (
{"session_id": session_id, "events": recordings_lookup[session_id]}
for session_id in (event[2] for event in event_results)
for session_id in set(event[2] for event in event_results)
if session_id in recordings_lookup
)

Expand All @@ -66,7 +66,7 @@ def enrich_with_actors(
yield new_row

def prepare_recordings(self, column_name, input_columns):
if column_name != "person" or "matched_recordings" not in input_columns:
if (column_name != "person" and column_name != "actor") or "matched_recordings" not in input_columns:
return None, None

column_index_events = input_columns.index("matched_recordings")
Expand Down

0 comments on commit 75bbd6c

Please sign in to comment.