From 8f1343bc427d2cb5f7367c15362f9eb7b9bb1275 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 21 Jul 2022 17:14:27 +0200 Subject: [PATCH] perspectives: fixed incremental loading --- packages/datalib/src/PerspectiveCache.ts | 4 +++- packages/datalib/src/PerspectiveDataLoader.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/datalib/src/PerspectiveCache.ts b/packages/datalib/src/PerspectiveCache.ts index d8f2450d1..c4705ab48 100644 --- a/packages/datalib/src/PerspectiveCache.ts +++ b/packages/datalib/src/PerspectiveCache.ts @@ -40,7 +40,9 @@ export class PerspectiveCache { tables: { [tableKey: string]: PerspectiveCacheTable } = {}; getTableCache(props: PerspectiveDataLoadProps) { - const tableKey = this.stableStringify(_omit(props, ['range', 'bindingValues', 'dataColumns'])); + const tableKey = this.stableStringify( + _pick(props, ['schemaName', 'pureName', 'bindingColumns', 'databaseConfig', 'orderBy']) + ); let res = this.tables[tableKey]; if (res && _difference(props.dataColumns, res.dataColumns).length > 0) { diff --git a/packages/datalib/src/PerspectiveDataLoader.ts b/packages/datalib/src/PerspectiveDataLoader.ts index 3020682bd..6ddc49301 100644 --- a/packages/datalib/src/PerspectiveDataLoader.ts +++ b/packages/datalib/src/PerspectiveDataLoader.ts @@ -81,7 +81,7 @@ export class PerspectiveDataLoader { }, })), selectAll: !dataColumns, - orderBy: dataColumns?.map(columnName => ({ + orderBy: orderBy?.map(columnName => ({ exprType: 'column', columnName, direction: 'ASC', @@ -106,7 +106,7 @@ export class PerspectiveDataLoader { } if (dbg?.enabled) { - dbg(`LOAD DATA, table=${props.pureName}, columns=${props.dataColumns?.join(',')}, range=${props.range}}`); + dbg(`LOAD DATA, table=${props.pureName}, columns=${props.dataColumns?.join(',')}, range=${props.range?.offset},${props.range?.limit}`); } const response = await this.apiCall('database-connections/sql-select', {