diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/pages/pages-table.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/pages/pages-table.tsx index 0dd9c348..c8eaf9f6 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/pages/pages-table.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/pages/pages-table.tsx @@ -1,114 +1,123 @@ 'use client'; +import { memo } from 'react'; import { LazyChart } from '@/components/report/chart/LazyChart'; import { useNumber } from '@/hooks/useNumerFormatter'; import { cn } from '@/utils/cn'; +import isEqual from 'lodash.isequal'; import { ExternalLinkIcon } from 'lucide-react'; import type { IServicePage } from '@openpanel/db'; -export function PagesTable({ data }: { data: IServicePage[] }) { - const number = useNumber(); - const cell = - 'flex min-h-12 whitespace-nowrap px-4 align-middle shadow-[0_0_0_0.5px] shadow-border'; - return ( -
-
-
-
- Views -
-
- Path -
-
- Chart -
-
- {data.map((item, index) => { - return ( -
-
- {number.short(item.count)} -
-
- {item.title} - {item.origin ? ( - - - {item.path} - - ) : ( - - {item.path} - - )} -
-
- -
+export const PagesTable = memo( + ({ data }: { data: IServicePage[] }) => { + const number = useNumber(); + const cell = + 'flex min-h-12 whitespace-nowrap px-4 align-middle shadow-[0_0_0_0.5px] shadow-border'; + return ( +
+
+
+
+ Views
- ); - })} +
+ Path +
+
+ Chart +
+
+ {data.map((item, index) => { + return ( +
+
+ {number.short(item.count)} +
+
+ {item.title} + {item.origin ? ( + + + {item.path} + + ) : ( + + {item.path} + + )} +
+
+ +
+
+ ); + })} +
-
- ); -} + ); + }, + (prevProps, nextProps) => { + return isEqual(prevProps.data, nextProps.data); + } +); + +PagesTable.displayName = 'PagesTable'; diff --git a/packages/db/src/services/event.service.ts b/packages/db/src/services/event.service.ts index ade98bec..021622a3 100644 --- a/packages/db/src/services/event.service.ts +++ b/packages/db/src/services/event.service.ts @@ -618,7 +618,7 @@ export async function getTopPages({ WHERE name = 'screen_view' AND project_id = ${escape(projectId)} AND created_at > now() - INTERVAL 30 DAY - ${search ? `AND path LIKE '%${search}%'` : ''} + ${search ? `AND path ILIKE '%${search}%'` : ''} GROUP BY path, project_id, origin ORDER BY count desc LIMIT ${take}