From 7ffc3cc3cce6f23e953c9bb3960d5a1c07681512 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Thu, 5 Sep 2024 12:46:43 +0100 Subject: [PATCH] fix: event property loading (#24807) --- .../player/sessionRecordingDataLogic.ts | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts index d3f2fd1aff2e6..d5035a871c430 100644 --- a/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts +++ b/frontend/src/scenes/session-recordings/player/sessionRecordingDataLogic.ts @@ -487,38 +487,33 @@ export const sessionRecordingDataLogic = kea([ return values.sessionEventsData } - const { person } = values.sessionPlayerData + if (!event.id) { + captureMessage('event id not available for matching', { + tags: { feature: 'session-recording-load-full-event-data' }, + extra: { event }, + }) + return values.sessionEventsData + } let loadedProperties: Record = existingEvent.properties try { const query: HogQLQuery = { kind: NodeKind.HogQLQuery, - query: hogql`SELECT properties, timestamp, uuid + query: hogql`SELECT properties, uuid FROM events WHERE timestamp > ${dayjs(event.timestamp).subtract(1000, 'ms')} AND timestamp < ${dayjs(event.timestamp).add(1000, 'ms')} - ${person?.id ? `AND person.id = ${person.id}` : ''} AND event = ${event.event} - ORDER BY timestamp ASC`, + AND uuid = ${event.id}`, } const response = await api.query(query) if (response.error) { throw new Error(response.error) } - // historically we compared timestamps here when finding properties for a particular event - // it's nicer to use the event id - // but since we were using timestamps, we might not be guaranteed to have the id? - // TODO - check if we can remove the timestamp comparison const result = response.results.find((x: any) => { - if (event.id) { - return x[2] === event.id - } - captureMessage('event id not available for matching', { - tags: { feature: 'session-recording-load-full-event-data' }, - }) - return x[1] === event.timestamp + return x[1] === event.id }) if (result) {