Skip to content

Commit dfd44d7

Browse files
committed
Don't run any afterSave hooks if none are registered.
1 parent 596e1fd commit dfd44d7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/RestWrite.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,15 @@ RestWrite.prototype.runDatabaseOperation = function() {
816816

817817
// Returns nothing - doesn't wait for the trigger.
818818
RestWrite.prototype.runAfterTrigger = function() {
819+
if (this.response) {
820+
return;
821+
}
822+
823+
// Avoid doing any setup for triggers if there is no 'afterSave' trigger for this class.
824+
if (!triggers.triggerExists(this.className, triggers.Types.afterSave, this.config.applicationId)) {
825+
return Promise.resolve();
826+
}
827+
819828
var extraData = {className: this.className};
820829
if (this.query && this.query.objectId) {
821830
extraData.objectId = this.query.objectId;

0 commit comments

Comments
 (0)