MCPcopy Index your code
hub / github.com/microsoft/data-formulator / computeDisplayRowsCacheKey

Function computeDisplayRowsCacheKey

src/app/displayRowsCache.ts:27–43  ·  view source on GitHub ↗
(
    table: DictTable,
    chart: Chart,
    conceptShelfItems: FieldItem[],
)

Source from the content-addressed store, hash-verified

25
26/** Build the cache key the canvas uses for a given table + chart. */
27export function computeDisplayRowsCacheKey(
28 table: DictTable,
29 chart: Chart,
30 conceptShelfItems: FieldItem[],
31): string {
32 const { aggregateFields, groupByFields } = extractFieldsFromEncodingMap(
33 chart.encodingMap, conceptShelfItems,
34 );
35 const sortedFields = [
36 ...aggregateFields.map(f => `${f[0]}_${f[1]}`),
37 ...groupByFields,
38 ].sort();
39 const contentSuffix = table.contentHash
40 ? `-${table.contentHash.slice(0, 8)}`
41 : `-${table.rows.length}`;
42 return `${table.id}-${sortedFields.join('_')}${contentSuffix}`;
43}

Callers 1

ChartRenderServiceFunction · 0.90

Calls 1

Tested by

no test coverage detected