From 7287a0569736dd6bf489d360b54813882b417277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Mon, 3 Nov 2025 22:04:13 +0100 Subject: [PATCH] fix: handle profiles which are not identified but the event has profile_id --- apps/start/src/components/profiles/profile-properties.tsx | 8 ++++++-- ...tionId.$projectId_.profiles.$profileId._tabs.index.tsx | 7 ------- ...ganizationId.$projectId_.profiles.$profileId._tabs.tsx | 7 +++---- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/apps/start/src/components/profiles/profile-properties.tsx b/apps/start/src/components/profiles/profile-properties.tsx index b035f112..0ad4fbf8 100644 --- a/apps/start/src/components/profiles/profile-properties.tsx +++ b/apps/start/src/components/profiles/profile-properties.tsx @@ -5,6 +5,7 @@ import { formatDateTime } from '@/utils/date'; import { parseAsStringEnum, useQueryState } from 'nuqs'; import type { IServiceEvent, IServiceProfile } from '@openpanel/db'; +import { FullPageEmptyState } from '../full-page-empty-state'; import { WidgetButtons, WidgetHead } from '../overview/overview-widget'; type Props = { @@ -44,7 +45,7 @@ export const ProfileProperties = ({ profile }: Props) => { - {tab === 'profile' && ( + {tab === 'profile' && profile && ( { /> )} - {tab === 'properties' && ( + {tab === 'properties' && profile && ( { }))} /> )} + {(!profile || !profile.properties) && ( + + )} ); }; diff --git a/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.index.tsx b/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.index.tsx index f50b07c5..f1fa52a2 100644 --- a/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.index.tsx +++ b/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.index.tsx @@ -41,12 +41,6 @@ export const Route = createFileRoute( projectId: params.projectId, }), ), - context.queryClient.prefetchQuery( - context.trpc.event.events.queryOptions({ - profileId: params.profileId, - projectId: params.projectId, - }), - ), ]); }, pendingComponent: FullPageLoadingState, @@ -56,7 +50,6 @@ function Component() { const { profileId, projectId, organizationId } = Route.useParams(); const trpc = useTRPC(); - // Get profile data from parent route const profile = useSuspenseQuery( trpc.profile.byId.queryOptions({ profileId, diff --git a/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.tsx b/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.tsx index a5d8f2c1..78492879 100644 --- a/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.tsx +++ b/apps/start/src/routes/_app.$organizationId.$projectId_.profiles.$profileId._tabs.tsx @@ -6,12 +6,9 @@ import { SerieIcon } from '@/components/report-chart/common/serie-icon'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { usePageTabs } from '@/hooks/use-page-tabs'; import { useTRPC } from '@/integrations/trpc/react'; -import { cn } from '@/utils/cn'; import { getProfileName } from '@/utils/getters'; import { useSuspenseQuery } from '@tanstack/react-query'; import { Outlet, createFileRoute, useRouter } from '@tanstack/react-router'; -import { CheckIcon, CopyIcon } from 'lucide-react'; -import { useState } from 'react'; export const Route = createFileRoute( '/_app/$organizationId/$projectId_/profiles/$profileId/_tabs', @@ -62,7 +59,9 @@ function Component() {
- {getProfileName(profile.data, false)} + {profile.data + ? getProfileName(profile.data, false) + : 'User not identified'}
}