Merge pull request #1567 from Budibase/fix/client-formula-schema

Fix formula fields causing handlebars enrichment to fail
This commit is contained in:
Andrew Kingston 2021-05-26 17:43:10 +01:00 committed by GitHub
commit 03445158d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -6,7 +6,16 @@ import { enrichRows } from "./rows"
* Since definitions cannot change at runtime, the result is cached. * Since definitions cannot change at runtime, the result is cached.
*/ */
export const fetchTableDefinition = async tableId => { 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
} }
/** /**