Skip to content

Commit

Permalink
Merge pull request #40104 from JKobrynski/addUndefinedCheckToPromiseW…
Browse files Browse the repository at this point in the history
…hile

[No QA] Check for undefined in promiseWhile.ts - follow-up
  • Loading branch information
mountiny authored Apr 15, 2024
2 parents 2815cf2 + 927b522 commit 447f0f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12738,6 +12738,10 @@ function promiseWhile(condition, action) {
else {
const actionResult = action?.();
console.info('[promiseWhile] promiseWhile() actionResult', actionResult);
if (!actionResult) {
resolve();
return;
}
Promise.resolve(actionResult).then(loop).catch(reject);
}
};
Expand Down
6 changes: 6 additions & 0 deletions .github/libs/promiseWhile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ function promiseWhile(condition: () => boolean, action: (() => Promise<void>) |
} else {
const actionResult = action?.();
console.info('[promiseWhile] promiseWhile() actionResult', actionResult);

if (!actionResult) {
resolve();
return;
}

Promise.resolve(actionResult).then(loop).catch(reject);
}
};
Expand Down

0 comments on commit 447f0f7

Please sign in to comment.