Skip to content

Commit 6fe3d52

Browse files
enable dynamic table row creation for faster data loading (#62)
1 parent 4ff6cc4 commit 6fe3d52

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

src/renderer/render.ts

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type {
2-
OutputItem, RendererContext
2+
OutputItem,
3+
RendererContext
34
} from 'vscode-notebook-renderer';
45
import { OutputLoader } from './outputLoader';
6+
import './style.css';
57
const aq = require('arquero');
68
const inputs = require('@observablehq/inputs');
7-
import './style.css';
9+
810

911
/**
1012
* Notebook cell output render info.
@@ -39,7 +41,6 @@ export function render(output: IRenderInfo) {
3941
layout: 'auto',
4042
width: 'auto',
4143
height: 360,
42-
rows: lengthOf(data)
4344
});
4445

4546
// add table to cell data output container
@@ -59,27 +60,3 @@ if (module.hot) {
5960
// TODO: dispose resources and save renderer state
6061
});
6162
}
62-
63-
/**
64-
* Gets data length.
65-
* @param data Data array, set, map, or arquero table.
66-
* @returns Dataset length/size or row count.
67-
*/
68-
function lengthOf(data: any) {
69-
if (typeof data.length === 'number') {
70-
// array or array-like
71-
return data.length;
72-
}
73-
74-
if (typeof data.size === 'number') {
75-
// map or set
76-
return data.size;
77-
}
78-
79-
if (typeof data.numRows === 'function') {
80-
// arquero
81-
return data.numRows();
82-
}
83-
84-
return 0;
85-
}

0 commit comments

Comments
 (0)