Remove unneeded memo

This commit is contained in:
2024-05-03 01:19:06 +01:00
parent 4c2cb0ecec
commit 292dfc4870
2 changed files with 5 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import { useEffect, useMemo, useState } from 'react';
import { useEffect, useState } from 'react';
import { ChartCard } from './index';
export const Cpu = () => {
@@ -18,12 +18,12 @@ export const Cpu = () => {
}
}, [dynamicData]);
const total_cpus = useMemo(() => history.at(-1)?.length ?? 0, [history]);
if (!staticData || !dynamicData) {
return <div />;
}
const total_cpus = dynamicData.cpu_usage.length;
return (
!!total_cpus && (
<ChartCard

View File

@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query';
import { useEffect, useMemo, useState } from 'react';
import { useEffect, useState } from 'react';
import { ChartCard } from './index';
export const Temps = () => {
@@ -18,8 +18,6 @@ export const Temps = () => {
}
}, [dynamicData]);
const total_sensors = useMemo(() => history.at(-1)?.length ?? 0, [history]);
if (!staticData || !dynamicData) {
return <div />;
}
@@ -33,7 +31,7 @@ export const Temps = () => {
}}
formatOptions={{ si: true, prefix: false, units: 'ºC' }}
data={history}
total={total_sensors}
total={staticData.components.length}
/>
);
};