mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-15 07:54:18 +02:00
add more memoization to the ItemTableList
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import clsx from 'clsx';
|
||||
import { memo } from 'react';
|
||||
|
||||
import styles from './text-column.module.css';
|
||||
|
||||
@@ -9,7 +10,7 @@ import {
|
||||
TableColumnTextContainer,
|
||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||
|
||||
export const TextColumn = (props: ItemTableListInnerColumn) => {
|
||||
const TextColumnBase = (props: ItemTableListInnerColumn) => {
|
||||
const rowItem = props.getRowItem?.(props.rowIndex) ?? (props.data as any[])[props.rowIndex];
|
||||
const row: string | undefined = (rowItem as any)?.[props.columns[props.columnIndex].id];
|
||||
|
||||
@@ -33,3 +34,13 @@ export const TextColumn = (props: ItemTableListInnerColumn) => {
|
||||
|
||||
return <ColumnSkeletonVariable {...props} />;
|
||||
};
|
||||
|
||||
export const TextColumn = memo(TextColumnBase, (prevProps, nextProps) => {
|
||||
return (
|
||||
prevProps.rowIndex === nextProps.rowIndex &&
|
||||
prevProps.columnIndex === nextProps.columnIndex &&
|
||||
prevProps.data === nextProps.data &&
|
||||
prevProps.columns === nextProps.columns &&
|
||||
prevProps.size === nextProps.size
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user