Use infinite scroll in metrics explorer for faster rendering

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2024-09-05 14:44:45 +02:00
parent 1f8a6b4d6e
commit 331a8e1d6c

View file

@ -9,6 +9,7 @@ import { IconCodePlus, IconCopy, IconZoomCode } from "@tabler/icons-react";
import LabelsExplorer from "./LabelsExplorer"; import LabelsExplorer from "./LabelsExplorer";
import { useDebouncedValue } from "@mantine/hooks"; import { useDebouncedValue } from "@mantine/hooks";
import classes from "./MetricsExplorer.module.css"; import classes from "./MetricsExplorer.module.css";
import CustomInfiniteScroll from "../../../components/CustomInfiniteScroll";
const fuz = new Fuzzy({ const fuz = new Fuzzy({
pre: '<b style="color: rgb(0, 102, 191)">', pre: '<b style="color: rgb(0, 102, 191)">',
@ -83,6 +84,9 @@ const MetricsExplorer: FC<MetricsExplorerProps> = ({
} }
autoFocus autoFocus
/> />
<CustomInfiniteScroll
allItems={searchMatches}
child={({ items }) => (
<Table> <Table>
<Table.Thead> <Table.Thead>
<Table.Tr> <Table.Tr>
@ -92,7 +96,7 @@ const MetricsExplorer: FC<MetricsExplorerProps> = ({
</Table.Tr> </Table.Tr>
</Table.Thead> </Table.Thead>
<Table.Tbody> <Table.Tbody>
{searchMatches.map((m) => ( {items.map((m) => (
<Table.Tr key={m.original}> <Table.Tr key={m.original}>
<Table.Td> <Table.Td>
<Group justify="space-between"> <Group justify="space-between">
@ -172,6 +176,8 @@ const MetricsExplorer: FC<MetricsExplorerProps> = ({
))} ))}
</Table.Tbody> </Table.Tbody>
</Table> </Table>
)}
/>
</Stack> </Stack>
); );
}; };