Closed ckosloski closed 8 years ago
@eugef I meant to say #439, not #239. Can you reopen #239 and close #439?
@ckosloski done
@vitalets @eugef Guys, when do u plan to publish it at NPM?
Not sure what happened here, but the code removed by @ckosloski is still available:
Removed: https://github.com/vitalets/angular-xeditable/pull/500/files#r70768015
Still there: https://github.com/vitalets/angular-xeditable/blob/master/dist/js/xeditable.js#L798
This needs to be addressed asap. I just ran into an issue where a scope watcher did not exist, yet the loop was called and it failed miserably.
angular.min.js:89 TypeError: Cannot read property 'length' of null at EditableController.self.hide (http://localhost:3000/javascripts/libs/xeditable.min.js:801:48) at http://localhost:3000/javascripts/libs/xeditable.min.js:1326:18 at Array.forEach (native) at Object.q [as forEach] (http://localhost:3000/javascripts/libs/angular.min.js:7:280) at Object.$hide (http://localhost:3000/javascripts/libs/xeditable.min.js:1325:15) at Object.$cancel (http://localhost:3000/javascripts/libs/xeditable.min.js:1350:12) at http://localhost:3000/javascripts/libs/xeditable.min.js:1190:50 at Array.forEach (native) at Object.q [as forEach] (http://localhost:3000/javascripts/libs/angular.min.js:7:280)
If you pretend keeping the loop @ "https://github.com/vitalets/angular-xeditable/blob/master/dist/js/xeditable.js#L798", you must make sure to only call it when the $$scope.watchers exist:
// Check if a watcher exists
if ($scope.$$watchers != null) {
// Manually remove the watcher on 'has-error' to prevent a memory leak on it.
for (var i = 0, len = $scope.$$watchers.length; i < len; i++) {
if ($scope.$$watchers[i] !== undefined && $scope.$$watchers[i].last && $scope.$$watchers[i].last !== undefined &&
typeof $scope.$$watchers[i].last === 'object' && "has-error" in $scope.$$watchers[i].last) {
$scope.$$watchers.splice(i, 1);
break;
}
}
}
@eugef
It's impossible to use package with such error! @eugef @vitalets @atodicebear
Please, could you add @Burnett01 correction??
if ($scope.$$watchers != null) {
It 's blocking