Skip to content

Commit

Permalink
stop extra calls to validate
Browse files Browse the repository at this point in the history
  • Loading branch information
w33ble committed Oct 28, 2014
1 parent 20094dd commit 5b0f72f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/kibana/directives/validate_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ define(function (require) {
body: {
query: query || { match_all: {} }
}
}).then(success, error);
})
.then(success, error);
}

function error(resp) {
Expand Down Expand Up @@ -140,7 +141,10 @@ define(function (require) {

// Use a model watch instead of parser/formatter. Parsers require the
// user to actually enter input, which may not happen if the back button is clicked
$scope.$watch('ngModel', debouncedValidator);
$scope.$watch('ngModel', function (newValue, oldValue) {
if (newValue === oldValue) return;
debouncedValidator(newValue);
});

init();
}
Expand Down

0 comments on commit 5b0f72f

Please sign in to comment.