From 4728b5278053bb86f7aee1129033b1110b96c309 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 5 Jan 2022 14:26:13 +0000 Subject: [PATCH] Fix paginationValues being attached to every object inside a query due to recursion --- packages/server/src/threads/query.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/server/src/threads/query.js b/packages/server/src/threads/query.js index 6b5c427b16..8232321084 100644 --- a/packages/server/src/threads/query.js +++ b/packages/server/src/threads/query.js @@ -32,6 +32,12 @@ class QueryRunner { // pre-query, make sure datasource variables are added to parameters const parameters = await this.addDatasourceVariables() let query = this.enrichQueryFields(fields, parameters) + + // Add pagination values for REST queries + if (this.pagination) { + query.paginationValues = this.pagination + } + const Integration = integrations[datasource.source] if (!Integration) { throw "Integration type does not exist." @@ -186,7 +192,6 @@ class QueryRunner { enrichedQuery[key] = fields[key] } } - if ( enrichedQuery.json || enrichedQuery.customData || @@ -203,12 +208,6 @@ class QueryRunner { } delete enrichedQuery.customData } - - // Just for REST queries - if (this.pagination) { - enrichedQuery.paginationValues = this.pagination - } - return enrichedQuery } }