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

This commit is contained in:
jack zhang 2024-08-02 15:34:16 +08:00 committed by GitHub
parent 08f25c2336
commit 6791db5fe1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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`
@ -149,11 +149,11 @@ const useTableColumns = (props: { showDel?: boolean; isSubTable?: boolean }) =>
return { record, schema: s };
},
} 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(() => {