Skip to content

Commit

Permalink
Call rebindCallback on errors as well (#9690)
Browse files Browse the repository at this point in the history
(cherry picked from commit da0c82a)
  • Loading branch information
nielslyngsoe authored and nul800sebastiaan committed Jan 20, 2021
1 parent bc8f836 commit 52e8da2
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@

syncTreeNode($scope.content, data.path, false, args.reloadChildren);

eventsService.emit("content.saved", { content: $scope.content, action: args.action });
eventsService.emit("content.saved", { content: $scope.content, action: args.action, valid: true });

resetNestedFieldValiation(fieldsToRollback);
ensureDirtyIsSetIfAnyVariantIsDirty();
Expand All @@ -470,11 +470,14 @@
},
function (err) {

//needs to be manually set for infinite editing mode
$scope.page.isNew = false;

syncTreeNode($scope.content, $scope.content.path);

if (err.status === 400 && err.data) {
// content was saved but is invalid.
eventsService.emit("content.saved", { content: $scope.content, action: args.action, valid: false });
}

resetNestedFieldValiation(fieldsToRollback);

return $q.reject(err);
Expand Down

0 comments on commit 52e8da2

Please sign in to comment.