(
table: DictTable,
chart: Chart,
conceptShelfItems: FieldItem[],
)
| 25 | |
| 26 | /** Build the cache key the canvas uses for a given table + chart. */ |
| 27 | export 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 | } |
no test coverage detected