fix(app/mustache): reuse mustache variables in templates [EE-3689] (#7286)

pull/7270/head
LP B 2022-07-19 15:38:00 +02:00 committed by GitHub
parent 95f4db4f48
commit 1a8fe82821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -38,12 +38,15 @@ export function intersectVariables(
) { ) {
const oldVariablesWithLabel = oldVariables.filter((v) => !!v.label); const oldVariablesWithLabel = oldVariables.filter((v) => !!v.label);
return [ return _.uniqBy(
[
...oldVariablesWithLabel, ...oldVariablesWithLabel,
...newVariables.filter( ...newVariables.filter(
(v) => !oldVariablesWithLabel.find(({ name }) => name === v.name) (v) => !oldVariablesWithLabel.find(({ name }) => name === v.name)
), ),
]; ],
'name'
);
} }
export function renderTemplate( export function renderTemplate(