From 09938ae442bf5b94c0d7a5510df1023bd038d830 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 14 Aug 2024 13:13:15 +0200 Subject: [PATCH] Don't change key order on trimming --- packages/server/src/utilities/rowProcessor/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/server/src/utilities/rowProcessor/index.ts b/packages/server/src/utilities/rowProcessor/index.ts index 59b3ea7c16..4b2fd83882 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -19,7 +19,6 @@ import { User, } from "@budibase/types" import { cloneDeep } from "lodash/fp" -import { pick } from "lodash" import { processInputBBReference, processInputBBReferences, @@ -368,9 +367,16 @@ export async function outputProcessing( const tableFields = Object.keys(table.schema).filter( f => table.schema[f].visible !== false ) - enriched = enriched.map((r: Row) => - pick(r, [...tableFields, ...protectedColumns]) + const fields = [...tableFields, ...protectedColumns].map(f => + f.toLowerCase() ) + for (const row of enriched) { + for (const key of Object.keys(row)) { + if (!fields.includes(key.toLowerCase())) { + delete row[key] + } + } + } } return (wasArray ? enriched : enriched[0]) as T