Browse Source

fix: replace double curly brace

pull/7268/head
Pranav C 11 months ago
parent
commit
0457968fc2
  1. 7
      packages/nocodb-sdk/src/lib/formulaHelpers.ts
  2. 4
      packages/nocodb/src/services/columns.service.ts

7
packages/nocodb-sdk/src/lib/formulaHelpers.ts

@ -1097,9 +1097,10 @@ export function validateFormulaAndExtractTreeWithType(
if (col?.uidt === UITypes.Formula) {
// todo: check for circular reference
// todo: extract the type and return
const formulaRes = validateFormulaAndExtractTreeWithType(
col.colOptions.formula,
const formulaRes = col.colOptions?.parsed_tree || validateFormulaAndExtractTreeWithType(
// formula may include double curly brackets in previous version
// convert to single curly bracket here for compatibility
col.colOptions.formula.replaceAll('{{', '{').replaceAll('}}', '}'),
columns
);

4
packages/nocodb/src/services/columns.service.ts

@ -1210,7 +1210,9 @@ export class ColumnsService {
table.columns,
);
colBody.parsed_tree = validateFormulaAndExtractTreeWithType(
colBody.formula_raw || colBody.formula,
// formula may include double curly brackets in previous version
// convert to single curly bracket here for compatibility
colBody.formula_raw || colBody.formula?.replaceAll('{{', '{').replaceAll('}}', '}'),
table.columns,
);

Loading…
Cancel
Save