From db57b21e1a1f1eda5c7ef5d508902fa3ce49875e Mon Sep 17 00:00:00 2001 From: Katherine Date: Mon, 9 Sep 2024 17:33:03 +0800 Subject: [PATCH] refactor: support association field preloading in Handlebars templates (#5236) * chore: update ci * chore: update ci * fix: support association field preloading in Handlebars templates * fix: bug --------- Co-authored-by: xilesun <2013xile@gmail.com> --- .../core/client/src/schema-component/common/utils/uitls.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/core/client/src/schema-component/common/utils/uitls.tsx b/packages/core/client/src/schema-component/common/utils/uitls.tsx index abacb5720f..6dfc64bbe7 100644 --- a/packages/core/client/src/schema-component/common/utils/uitls.tsx +++ b/packages/core/client/src/schema-component/common/utils/uitls.tsx @@ -162,6 +162,11 @@ const getVariablesData = (localVariables) => { export async function getRenderContent(templateEngine, content, variables, localVariables, defaultParse) { if (content && templateEngine === 'handlebars') { try { + try { + await replaceVariableValue(content, variables, localVariables); + } catch (error) { + return null; + } const renderedContent = Handlebars.compile(content); // 处理渲染后的内容 const data = getVariablesData(localVariables);