Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions packages/dds/tree/src/test/tablePerformanceTestUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,19 @@ export function createTableTree({ tableSize, initialCellValue }: TableTreeOption
const columns = Array.from({ length: tableSize }, () => new Column({}));
table.insertColumns({ index: 0, columns });

const rows = Array.from(
{ length: tableSize },
() =>
new Row({
cells: {},
}),
);
table.insertRows({ index: 0, rows });

if (initialCellValue !== undefined) {
for (const row of table.rows) {
for (const column of table.columns) {
table.setCell({
key: {
column,
row,
},
cell: initialCellValue,
});
// Pre populate each row's cells at construction time so the entire dense table is initialized
// by a single `insertRows` op.
const columnIds = table.columns.map((column) => column.id);
const rows = Array.from({ length: tableSize }, () => {
const cells: Record<string, string> = {};
if (initialCellValue !== undefined) {
for (const columnId of columnIds) {
cells[columnId] = initialCellValue;
}
}
}
return new Row({ cells });
});
table.insertRows({ index: 0, rows });

// Configure event listeners
const cleanUpEventHandler = Tree.on(table, "treeChanged", () => {});
Expand Down
Loading