Skip to content

Commit

Permalink
refactor(Table): Improved Performance example colDefs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Pinedo committed Nov 29, 2023
1 parent 951bf1a commit 4f04b5a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions packages/table/src/recipes/tablesInfo/performance.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import { Holo } from '@devoinc/holo';
import { TableOptionsProps } from '../../declarations';
import { ColDef, TableOptionsProps } from '../../declarations';

const defaultColDef = {
id: 'company',
const colDefs: ColDef[] = Array.from({ length: 100 }, (_, index) => ({
id: `company_${index}`,
headerName: 'Company',
type: 'text',
cellStyle: {
width: 180,
},
};
}));

let index = 0;
const schemaObject = {};
Array.from({ length: 100 }).forEach((_el, index: number) => {
schemaObject[`company_${index}`] = 'company';
});

const defObject = {
...defaultColDef,
id: () => `company_${index++}`,
headerName: () => `Company ${index}`,
};
const colDefs = Holo.of().schema(defObject).repeat(100).generate();

export const performanceData = Holo.of()
.schema(schemaObject)
.repeat(100000)
Expand Down

0 comments on commit 4f04b5a

Please sign in to comment.