Loading Data
loadData
Section titled “loadData”| Type | (onChunk: (rows: TRow[], options?: ChunkSourceOptions) => void) => Promise<void> |
Async function that feeds data into the editor. Called once when the editor opens. Call onChunk one or more times to stream rows in batches. The editor processes each chunk without blocking the UI.
loadData={async (onChunk) => { const res = await fetch("/api/employees"); const rows = await res.json(); onChunk(rows);}}Multi-Source Loading
Section titled “Multi-Source Loading”Tag chunks with a data source to separate data from different origins. Sources are auto-registered on first encounter.
loadData={async (onChunk) => { const [sf, hs] = await Promise.all([fetchSalesforce(), fetchHubspot()]);
onChunk(sf.chunk1, { source: "Salesforce" }); onChunk(sf.chunk2, { source: "Salesforce", done: true });
onChunk(hs.data, { source: "HubSpot", deletable: true, done: true });}}Chunks without options go to “Existing Data”. You can mix tagged and untagged chunks freely.
ChunkSourceOptions
Section titled “ChunkSourceOptions”| Field | Type | Default | Description |
|---|---|---|---|
source | string | — | Display name for the data source. Required when tagging a source. |
id | string | source value | Stable identifier. |
deletable | boolean | false | Whether the user can delete this source from the editor. |
done | boolean | false | Marks this source as finished loading. Shows a completion state in the UI. |
Source Lifecycle
Section titled “Source Lifecycle”- The first
onChunkcall with a new source auto-registers it and starts its loading indicator. - Set
done: trueto mark a source as finished. You can send an empty chunk:onChunk([], { source: "CRM", done: true }). - When the
loadDatapromise resolves, any source still loading is automatically finalized.
sampleData
Section titled “sampleData”| Type | Record<string, unknown>[] |
Sample rows included in the “Download Example” file. When the user clicks “Download Example” in the import wizard, the SDK generates a template file with column headers and these rows.
When omitted, a generic example row is auto-generated from column definitions.
sampleData={[]}