Move history from query data to ref and avoid rerenders

This commit is contained in:
2024-05-08 19:45:36 +01:00
parent 9f14c53762
commit 66bef70cb8
12 changed files with 122 additions and 105 deletions

View File

@@ -1,20 +1,13 @@
import { siAtom } from '@/atoms';
import { useQuery } from '@tanstack/react-query';
import { useAtomValue } from 'jotai';
import { ChartCard } from './common/card';
export const Disks = () => {
const { data: historyData } = useQuery<HistorySlice[]>({ queryKey: ['history'] });
const isSi = useAtomValue(siAtom);
if (!historyData) {
return <div />;
}
return (
<ChartCard
title='Disk activity'
// @ts-expect-error: write a better union later
legend={{
labels: ['Read', 'Write'],
}}