:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(persons): suppress link for personless persons (#60684)
Christiaan Hendriksen74ac7530ad68
diff --git a/frontend/src/queries/nodes/DataTable/renderColumn.tsx b/frontend/src/queries/nodes/DataTable/renderColumn.tsxindex 2252cb97c3a9..f701dd994c8a 100644--- a/frontend/src/queries/nodes/DataTable/renderColumn.tsx+++ b/frontend/src/queries/nodes/DataTable/renderColumn.tsx@@ -347,7 +347,9 @@ export function renderColumn(const noPopover = isActorsQuery(query.source)const displayProps: PersonDisplayProps = {withIcon: true,- person: { id: value.id, distinct_id: value.distinct_id },+ // `properties: {}` marks this row as an identified profile so PersonDisplay still renders the link;+ // the server-side `person_display_name` column omits `properties` even though these rows are profiled.+ person: { id: value.id, distinct_id: value.distinct_id, properties: {} },displayName: value.display_name,noPopover,}diff --git a/frontend/src/scenes/persons/PersonDisplay.tsx b/frontend/src/scenes/persons/PersonDisplay.tsxindex 5292a2160a04..03761436a6ec 100644--- a/frontend/src/scenes/persons/PersonDisplay.tsx+++ b/frontend/src/scenes/persons/PersonDisplay.tsx@@ -149,7 +149,7 @@ export function PersonDisplay({className={clsx('PersonDisplay', muted && 'PersonDisplay--muted', className)}onClick={!noPopover ? handleClick : undefined}>- {noLink || !href || (visible && !person?.properties) ? (+ {noLink || !href || !person?.properties ? (content) : (<Linkdiff --git a/frontend/src/scenes/persons/person-utils.test.ts b/frontend/src/scenes/persons/person-utils.test.tsindex 36f68a0f9eb9..eb34d182c502 100644--- a/frontend/src/scenes/persons/person-utils.test.ts+++ b/frontend/src/scenes/persons/person-utils.test.ts@@ -81,9 +81,13 @@ describe('the person header', () => {it.each(personLinksTestCases.map((testCase) => [testCase.name, testCase]))('returns a link %s',(_, testCase) => {- expect(asLink({ distinct_ids: testCase.distinctIds })).toEqual(testCase.expectedLink)+ expect(asLink({ distinct_ids: testCase.distinctIds, properties: {} })).toEqual(testCase.expectedLink)})++ it('returns undefined for a person without a profile', () => {+ expect(asLink({ distinct_ids: ['a uuid'] })).toBeUndefined()+ })})const displayTestCases = [diff --git a/frontend/src/scenes/persons/person-utils.ts b/frontend/src/scenes/persons/person-utils.tsindex 0b16f178be80..7d310754b6e5 100644--- a/frontend/src/scenes/persons/person-utils.ts+++ b/frontend/src/scenes/persons/person-utils.ts@@ -131,14 +131,18 @@ export function coercePropertyValue(value: string | number | boolean | null): streturn result}-export const asLink = (person?: PersonPropType | null): string | undefined =>- person?.distinct_id+export const asLink = (person?: PersonPropType | null): string | undefined => {+ if (!person?.properties) {+ return undefined+ }+ return person.distinct_id? urls.personByDistinctId(person.distinct_id)- : person?.distinct_ids?.length+ : person.distinct_ids?.length? urls.personByDistinctId(person.distinct_ids[0])- : person?.id+ : person.id? urls.personByUUID(person.id): undefined+}/*** Parse a row from the HogQL person query into a PersonType.