1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

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

This commit is contained in:
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

View file

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