From 292dfc4870e1955140494cea1a41244e3f2d25c7 Mon Sep 17 00:00:00 2001 From: luisdralves Date: Fri, 3 May 2024 01:19:06 +0100 Subject: [PATCH] Remove unneeded memo --- src/client/components/chart-cards/cpu.tsx | 6 +++--- src/client/components/chart-cards/temps.tsx | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/client/components/chart-cards/cpu.tsx b/src/client/components/chart-cards/cpu.tsx index 9bbbd47..df849b7 100644 --- a/src/client/components/chart-cards/cpu.tsx +++ b/src/client/components/chart-cards/cpu.tsx @@ -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
; } + const total_cpus = dynamicData.cpu_usage.length; + return ( !!total_cpus && ( { @@ -18,8 +18,6 @@ export const Temps = () => { } }, [dynamicData]); - const total_sensors = useMemo(() => history.at(-1)?.length ?? 0, [history]); - if (!staticData || !dynamicData) { return
; } @@ -33,7 +31,7 @@ export const Temps = () => { }} formatOptions={{ si: true, prefix: false, units: 'ÂșC' }} data={history} - total={total_sensors} + total={staticData.components.length} /> ); };