fix: handle profiles which are not identified but the event has profile_id
This commit is contained in:
@@ -5,6 +5,7 @@ import { formatDateTime } from '@/utils/date';
|
|||||||
import { parseAsStringEnum, useQueryState } from 'nuqs';
|
import { parseAsStringEnum, useQueryState } from 'nuqs';
|
||||||
|
|
||||||
import type { IServiceEvent, IServiceProfile } from '@openpanel/db';
|
import type { IServiceEvent, IServiceProfile } from '@openpanel/db';
|
||||||
|
import { FullPageEmptyState } from '../full-page-empty-state';
|
||||||
import { WidgetButtons, WidgetHead } from '../overview/overview-widget';
|
import { WidgetButtons, WidgetHead } from '../overview/overview-widget';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -44,7 +45,7 @@ export const ProfileProperties = ({ profile }: Props) => {
|
|||||||
</WidgetButtons>
|
</WidgetButtons>
|
||||||
</WidgetHead>
|
</WidgetHead>
|
||||||
|
|
||||||
{tab === 'profile' && (
|
{tab === 'profile' && profile && (
|
||||||
<KeyValueGrid
|
<KeyValueGrid
|
||||||
copyable
|
copyable
|
||||||
className="border-0"
|
className="border-0"
|
||||||
@@ -92,7 +93,7 @@ export const ProfileProperties = ({ profile }: Props) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{tab === 'properties' && (
|
{tab === 'properties' && profile && (
|
||||||
<KeyValueGrid
|
<KeyValueGrid
|
||||||
copyable
|
copyable
|
||||||
className="border-0"
|
className="border-0"
|
||||||
@@ -109,6 +110,9 @@ export const ProfileProperties = ({ profile }: Props) => {
|
|||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{(!profile || !profile.properties) && (
|
||||||
|
<FullPageEmptyState title="No properties found" />
|
||||||
|
)}
|
||||||
</Widget>
|
</Widget>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,12 +41,6 @@ export const Route = createFileRoute(
|
|||||||
projectId: params.projectId,
|
projectId: params.projectId,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
context.queryClient.prefetchQuery(
|
|
||||||
context.trpc.event.events.queryOptions({
|
|
||||||
profileId: params.profileId,
|
|
||||||
projectId: params.projectId,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
pendingComponent: FullPageLoadingState,
|
pendingComponent: FullPageLoadingState,
|
||||||
@@ -56,7 +50,6 @@ function Component() {
|
|||||||
const { profileId, projectId, organizationId } = Route.useParams();
|
const { profileId, projectId, organizationId } = Route.useParams();
|
||||||
const trpc = useTRPC();
|
const trpc = useTRPC();
|
||||||
|
|
||||||
// Get profile data from parent route
|
|
||||||
const profile = useSuspenseQuery(
|
const profile = useSuspenseQuery(
|
||||||
trpc.profile.byId.queryOptions({
|
trpc.profile.byId.queryOptions({
|
||||||
profileId,
|
profileId,
|
||||||
|
|||||||
@@ -6,12 +6,9 @@ import { SerieIcon } from '@/components/report-chart/common/serie-icon';
|
|||||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||||
import { usePageTabs } from '@/hooks/use-page-tabs';
|
import { usePageTabs } from '@/hooks/use-page-tabs';
|
||||||
import { useTRPC } from '@/integrations/trpc/react';
|
import { useTRPC } from '@/integrations/trpc/react';
|
||||||
import { cn } from '@/utils/cn';
|
|
||||||
import { getProfileName } from '@/utils/getters';
|
import { getProfileName } from '@/utils/getters';
|
||||||
import { useSuspenseQuery } from '@tanstack/react-query';
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
||||||
import { Outlet, createFileRoute, useRouter } from '@tanstack/react-router';
|
import { Outlet, createFileRoute, useRouter } from '@tanstack/react-router';
|
||||||
import { CheckIcon, CopyIcon } from 'lucide-react';
|
|
||||||
import { useState } from 'react';
|
|
||||||
|
|
||||||
export const Route = createFileRoute(
|
export const Route = createFileRoute(
|
||||||
'/_app/$organizationId/$projectId_/profiles/$profileId/_tabs',
|
'/_app/$organizationId/$projectId_/profiles/$profileId/_tabs',
|
||||||
@@ -62,7 +59,9 @@ function Component() {
|
|||||||
<div className="row items-center gap-4 min-w-0">
|
<div className="row items-center gap-4 min-w-0">
|
||||||
<ProfileAvatar {...profile.data} />
|
<ProfileAvatar {...profile.data} />
|
||||||
<span className="truncate">
|
<span className="truncate">
|
||||||
{getProfileName(profile.data, false)}
|
{profile.data
|
||||||
|
? getProfileName(profile.data, false)
|
||||||
|
: 'User not identified'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user