Skip to content

Commit

Permalink
Ensure the Clusters template helper is initialized when calling an he…
Browse files Browse the repository at this point in the history
…lper that does not returns a block (#6815)
  • Loading branch information
vivien-apple authored and pull[bot] committed Jun 2, 2021
1 parent 3ce982b commit 1642596
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/app/zap-templates/templates/chip/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ const ChipTypesHelper = require('../../common/ChipTypesHelper.js');

function asBlocks(promise, options)
{
function fn(pkgId)
{
return Clusters.init(this, pkgId).then(() => promise.then(data => templateUtil.collectBlocks(data, options, this)));
}
return templateUtil.ensureZclPackageId(this).then(fn.bind(this)).catch(err => console.log(err));
const fn = pkgId => Clusters.init(this, pkgId).then(() => promise.then(data => templateUtil.collectBlocks(data, options, this)));
return templateUtil.ensureZclPackageId(this).then(fn).catch(err => console.log(err));
}

function asPromise(promise)
{
return templateUtil.templatePromise(this.global, promise);
const fn = pkgId => Clusters.init(this, pkgId).then(() => promise);
return templateUtil.ensureZclPackageId(this).then(fn).catch(err => console.log(err));
}

function throwErrorIfUndefined(item, errorMsg, conditions)
Expand Down

0 comments on commit 1642596

Please sign in to comment.