From 30c7c5148d4ec6c7b1742f32cdbccce74f39faf3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 26 May 2021 17:38:49 +0100 Subject: [PATCH] Fix formula fields causing handlebars enrichment of client component settings to fail --- packages/client/src/api/tables.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/client/src/api/tables.js b/packages/client/src/api/tables.js index 59381e35bf..6d9457cacb 100644 --- a/packages/client/src/api/tables.js +++ b/packages/client/src/api/tables.js @@ -6,7 +6,16 @@ import { enrichRows } from "./rows" * Since definitions cannot change at runtime, the result is cached. */ export const fetchTableDefinition = async tableId => { - return await API.get({ url: `/api/tables/${tableId}`, cache: true }) + const res = await API.get({ url: `/api/tables/${tableId}`, cache: true }) + + // Wipe any HBS formulae, as these interfere with handlebars enrichment + Object.keys(res?.schema || {}).forEach(field => { + if (res.schema[field]?.type === "formula") { + delete res.schema[field].formula + } + }) + + return res } /**