fix(T-4927): table performance bug (#4978)

This commit is contained in:
jack zhang 2024-08-02 15:34:16 +08:00 committed by Zeke Zhang
parent bed4f2922a
commit b13f40c455

View File

@ -96,7 +96,7 @@ const useTableColumns = (props: { showDel?: boolean; isSubTable?: boolean }) =>
return buf;
}, []);
// const hasChangedColumns = useColumnsDeepMemoized(columnsSchema);
const hasChangedColumns = useColumnsDeepMemoized(columnsSchema);
const schemaToolbarBigger = useMemo(() => {
return css`
@ -146,11 +146,11 @@ const useTableColumns = (props: { showDel?: boolean; isSubTable?: boolean }) =>
);
},
} as TableColumnProps<any>;
}),
// 这里不能把 columnsSchema 作为依赖,因为其每次都会变化,这里使用 hasChangedColumns 作为依赖
// eslint-disable-next-line react-hooks/exhaustive-deps
}),
[columnsSchema, field.value, field.address, collection, parentRecordData, schemaToolbarBigger],
[hasChangedColumns, field.value, field.address, collection, parentRecordData, schemaToolbarBigger],
);
const tableColumns = useMemo(() => {