Skip to content

Commit 9539593

Browse files
committed
Fix logic in isEntityRelevant() to include all entities and operations if the user left the props empty
1 parent 7931dd8 commit 9539593

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

components/quickbooks/sources/common.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,15 @@ module.exports = {
8484
} = entity;
8585
const relevantEntities = this.getEntities();
8686
const relevantOperations = this.getOperations();
87-
88-
if (!relevantEntities.includes(name)) {
87+
88+
// only emit events that match the entity names and operations indicated by the user
89+
// but if the props are left empty, emit all events rather than filtering them all out
90+
// (it would a hassle for the user to select every option if they wanted to emit everything)
91+
if (relevantEntities?.length > 0 && !relevantEntities.includes(name)) {
8992
console.log(`Skipping '${operation} ${name}' event. (Accepted entities: ${relevantEntities.join(", ")})`);
9093
return false;
9194
}
92-
if (!relevantOperations.includes(operation)) {
95+
if (!relevantOperations?.length > 0 && !relevantOperations.includes(operation)) {
9396
console.log(`Skipping '${operation} ${name}' event. (Accepted operations: ${relevantOperations.join(", ")})`);
9497
return false;
9598
}

0 commit comments

Comments
 (0)