Browse Source

chore(nocodb-sdk): remove unnecessary replace in formula

pull/4776/head
Wing-Kam Wong 2 years ago
parent
commit
a2cabc5b91
  1. 12
      packages/nocodb-sdk/src/lib/formulaHelpers.ts

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

@ -67,11 +67,7 @@ export async function substituteColumnAliasWithIdInFormula(
}; };
// register jsep curly hook // register jsep curly hook
jsep.plugins.register(jsepCurlyHook); jsep.plugins.register(jsepCurlyHook);
const parsedFormula = jsep( const parsedFormula = jsep(formula);
// formula may include double curly brackets in previous version
// convert to single curly bracket here for compatibility
formula.replaceAll('{{', '{').replaceAll('}}', '}')
);
await substituteId(parsedFormula); await substituteId(parsedFormula);
return jsepTreeToFormula(parsedFormula); return jsepTreeToFormula(parsedFormula);
} }
@ -106,11 +102,7 @@ export function substituteColumnIdWithAliasInFormula(
// register jsep curly hook // register jsep curly hook
jsep.plugins.register(jsepCurlyHook); jsep.plugins.register(jsepCurlyHook);
const parsedFormula = jsep( const parsedFormula = jsep(formula);
// formula may include double curly brackets in previous version
// convert to single curly bracket here for compatibility
formula.replaceAll('{{', '{').replaceAll('}}', '}')
);
const parsedRawFormula = rawFormula && jsep(rawFormula); const parsedRawFormula = rawFormula && jsep(rawFormula);
substituteId(parsedFormula, parsedRawFormula); substituteId(parsedFormula, parsedRawFormula);
return jsepTreeToFormula(parsedFormula); return jsepTreeToFormula(parsedFormula);

Loading…
Cancel
Save