fix: memo issue on tables
This commit is contained in:
@@ -65,7 +65,6 @@ const VirtualRow = memo(
|
|||||||
}: VirtualRowProps) {
|
}: VirtualRowProps) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={virtualRow.key}
|
|
||||||
data-index={virtualRow.index}
|
data-index={virtualRow.index}
|
||||||
ref={virtualRow.measureElement}
|
ref={virtualRow.measureElement}
|
||||||
className="absolute top-0 left-0 w-full border-b hover:bg-muted/50 transition-colors group/row"
|
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 (
|
return (
|
||||||
<VirtualRow
|
<VirtualRow
|
||||||
key={virtualRow.key}
|
key={row.id}
|
||||||
row={row}
|
row={row}
|
||||||
virtualRow={{
|
virtualRow={{
|
||||||
...virtualRow,
|
...virtualRow,
|
||||||
@@ -249,6 +248,7 @@ export const EventsTable = ({ query }: Props) => {
|
|||||||
},
|
},
|
||||||
onColumnVisibilityChange: setColumnVisibility,
|
onColumnVisibilityChange: setColumnVisibility,
|
||||||
onColumnOrderChange: setColumnOrder,
|
onColumnOrderChange: setColumnOrder,
|
||||||
|
getRowId: (row, index) => row.id ?? `loading-${index}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const inViewportRef = useRef<HTMLDivElement>(null);
|
const inViewportRef = useRef<HTMLDivElement>(null);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ export const ProfilesTable = memo(
|
|||||||
: updaterOrValue;
|
: updaterOrValue;
|
||||||
setPage(nextPagination.pageIndex + 1);
|
setPage(nextPagination.pageIndex + 1);
|
||||||
},
|
},
|
||||||
|
getRowId: (row, index) => row.id ?? `loading-${index}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ const VirtualRow = memo(
|
|||||||
}: VirtualRowProps) {
|
}: VirtualRowProps) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={virtualRow.key}
|
|
||||||
data-index={virtualRow.index}
|
data-index={virtualRow.index}
|
||||||
ref={virtualRow.measureElement}
|
ref={virtualRow.measureElement}
|
||||||
className="absolute top-0 left-0 w-full border-b hover:bg-muted/50 transition-colors group/row"
|
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 (
|
return (
|
||||||
<VirtualRow
|
<VirtualRow
|
||||||
key={virtualRow.key}
|
key={row.id}
|
||||||
row={row}
|
row={row}
|
||||||
virtualRow={{
|
virtualRow={{
|
||||||
...virtualRow,
|
...virtualRow,
|
||||||
@@ -275,6 +274,7 @@ export const SessionsTable = ({ query }: Props) => {
|
|||||||
columnVisibility,
|
columnVisibility,
|
||||||
},
|
},
|
||||||
onColumnVisibilityChange: setColumnVisibility,
|
onColumnVisibilityChange: setColumnVisibility,
|
||||||
|
getRowId: (row, index) => row.id ?? `loading-${index}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const inViewportRef = useRef<HTMLDivElement>(null);
|
const inViewportRef = useRef<HTMLDivElement>(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user