Skip to content

Commit

Permalink
fixes a TypeError in UpsertGraphOperation
Browse files Browse the repository at this point in the history
  • Loading branch information
capaj committed Oct 11, 2018
1 parent 792bf9d commit fa123bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/queryBuilder/operations/UpsertGraphOperation.js
Expand Up @@ -19,6 +19,9 @@ class UpsertGraphOperation extends InsertGraphOperation {
}

onBefore1(builder) {
if (Array.isArray(this.models) && this.models.length === 0) {
return;
}
this.graph = new UpsertGraph(this.models, this.isArray, this.upsertOpt);

return this.graph.build(builder).then(() => this.delete(builder));
Expand Down Expand Up @@ -76,6 +79,9 @@ class UpsertGraphOperation extends InsertGraphOperation {
}

onAfter2(builder, result) {
if (Array.isArray(this.models) && this.models.length === 0) {
return;
}
return this.relate(builder)
.then(() => this.update(builder))
.then(() => this.upsertRecursively(builder))
Expand Down

0 comments on commit fa123bf

Please sign in to comment.