mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 19:49:50 +01:00
feat: memoize row loader
This commit is contained in:
1 parent
cc51f660d4
commit
b556f5f7e8
1 file changed
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
import { Skeleton, Table } from '@radix-ui/themes';
|
import { Skeleton, Table } from '@radix-ui/themes';
|
||||||
import { times } from 'lodash';
|
import { times } from 'lodash';
|
||||||
import { useRef } from 'react';
|
import { memo, useRef } from 'react';
|
||||||
import { useIntersection } from '../../../../hooks/useIntersection';
|
import { useIntersection } from '../../../../hooks/useIntersection';
|
||||||
import { tankPerformanceSortTypeNamesArray } from '../../../../stores/tankPerformanceSort';
|
import { tankPerformanceSortTypeNamesArray } from '../../../../stores/tankPerformanceSort';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ interface RowLoaderProps {
|
|||||||
onIntersection?: () => void;
|
onIntersection?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RowLoader({ onIntersection }: RowLoaderProps) {
|
export const RowLoader = memo<RowLoaderProps>(({ onIntersection }) => {
|
||||||
const row = useRef<HTMLTableRowElement>(null);
|
const row = useRef<HTMLTableRowElement>(null);
|
||||||
|
|
||||||
useIntersection(() => onIntersection?.(), row, {
|
useIntersection(() => onIntersection?.(), row, {
|
||||||
@@ -28,4 +28,4 @@ export function RowLoader({ onIntersection }: RowLoaderProps) {
|
|||||||
))}
|
))}
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
Reference in new issue
Block a user