Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix: memo issue on tables

Carl-Gerhard Lindesvärd063e80a659eb
diff --git a/apps/start/src/components/events/table/index.tsx b/apps/start/src/components/events/table/index.tsx
index af06e9f77..300713997 100644
--- a/apps/start/src/components/events/table/index.tsx
+++ b/apps/start/src/components/events/table/index.tsx
@@ -65,7 +65,6 @@ const VirtualRow = memo(
}: VirtualRowProps) {
return (
<div
- key={virtualRow.key}
data-index={virtualRow.index}
ref={virtualRow.measureElement}
className="absolute top-0 left-0 w-full border-b hover:bg-muted/50 transition-colors group/row"
@@ -198,7 +197,7 @@ const VirtualizedEventsTable = ({
return (
<VirtualRow
- key={virtualRow.key}
+ key={row.id}
row={row}
virtualRow={{
...virtualRow,
@@ -249,6 +248,7 @@ export const EventsTable = ({ query }: Props) => {
},
onColumnVisibilityChange: setColumnVisibility,
onColumnOrderChange: setColumnOrder,
+ getRowId: (row, index) => row.id ?? `loading-${index}`,
});
const inViewportRef = useRef<HTMLDivElement>(null);
diff --git a/apps/start/src/components/profiles/table/index.tsx b/apps/start/src/components/profiles/table/index.tsx
index df46040e4..8617a0d20 100644
--- a/apps/start/src/components/profiles/table/index.tsx
+++ b/apps/start/src/components/profiles/table/index.tsx
@@ -66,6 +66,7 @@ export const ProfilesTable = memo(
: updaterOrValue;
setPage(nextPagination.pageIndex + 1);
},
+ getRowId: (row, index) => row.id ?? `loading-${index}`,
});
return (
diff --git a/apps/start/src/components/sessions/table/index.tsx b/apps/start/src/components/sessions/table/index.tsx
index fbf1920ae..40c5db68b 100644
--- a/apps/start/src/components/sessions/table/index.tsx
+++ b/apps/start/src/components/sessions/table/index.tsx
@@ -95,7 +95,6 @@ const VirtualRow = memo(
}: VirtualRowProps) {
return (
<div
- key={virtualRow.key}
data-index={virtualRow.index}
ref={virtualRow.measureElement}
className="absolute top-0 left-0 w-full border-b hover:bg-muted/50 transition-colors group/row"
@@ -225,7 +224,7 @@ const VirtualizedSessionsTable = ({
return (
<VirtualRow
- key={virtualRow.key}
+ key={row.id}
row={row}
virtualRow={{
...virtualRow,
@@ -275,6 +274,7 @@ export const SessionsTable = ({ query }: Props) => {
columnVisibility,
},
onColumnVisibilityChange: setColumnVisibility,
+ getRowId: (row, index) => row.id ?? `loading-${index}`,
});
const inViewportRef = useRef<HTMLDivElement>(null);