From b556f5f7e898b0c5afe196907f3fd3ec7e85c76b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Sun, 7 Jul 2024 18:48:32 -0500 Subject: [PATCH] feat: memoize row loader --- src/app/tools/tank-performance/components/RowLoader.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/tools/tank-performance/components/RowLoader.tsx b/src/app/tools/tank-performance/components/RowLoader.tsx index 7f199226c..418e93d52 100644 --- a/src/app/tools/tank-performance/components/RowLoader.tsx +++ b/src/app/tools/tank-performance/components/RowLoader.tsx @@ -1,6 +1,6 @@ import { Skeleton, Table } from '@radix-ui/themes'; import { times } from 'lodash'; -import { useRef } from 'react'; +import { memo, useRef } from 'react'; import { useIntersection } from '../../../../hooks/useIntersection'; import { tankPerformanceSortTypeNamesArray } from '../../../../stores/tankPerformanceSort'; @@ -8,7 +8,7 @@ interface RowLoaderProps { onIntersection?: () => void; } -export function RowLoader({ onIntersection }: RowLoaderProps) { +export const RowLoader = memo(({ onIntersection }) => { const row = useRef(null); useIntersection(() => onIntersection?.(), row, { @@ -28,4 +28,4 @@ export function RowLoader({ onIntersection }: RowLoaderProps) { ))} ); -} +});