Skip to content

Commit 45a0127

Browse files
dominusbelialmportuga
dominusbelial
authored andcommitted
Angular 1.6 "Possibly unhandled rejection: canceled" fix. bug number #5890 (#5949)
* Update ui-grid-column-menu.js * Update ui-grid-cell.js * Update ui-grid-footer.js * Update ui-grid-grid-footer.js * Update ui-grid-group-panel.js * Update ui-grid-header-cell.js * Update ui-grid-header.js * Update ui-grid-menu-button.js * Update ui-grid-menu.js * Update ui-grid-menu.js * Update ui-grid-row.js * Update ui-grid.js * Update ui-grid-column-menu.js * Update Grid.js * Update Grid.js * Update Grid.js * Update Grid.js * Update Grid.js * Update gridClassFactory.js * Update ui-grid-util.js * Update tree-base.js * Update tree-base.js * Update tree-base.js * Update tree-base.js
1 parent 5132e48 commit 45a0127

15 files changed

+42
-42
lines changed

src/features/tree-base/js/tree-base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@
10131013
if ( grid.options.treeRowHeaderAlwaysVisible === false && grid.treeBase.numberLevels <= 0 ){
10141014
newVisibility = false;
10151015
}
1016-
if ( rowHeader.visible !== newVisibility ) {
1016+
if ( rowHeader && rowHeader.visible !== newVisibility ) {
10171017
rowHeader.visible = newVisibility;
10181018
rowHeader.colDef.visible = newVisibility;
10191019
grid.queueGridRefresh();

src/js/core/directives/ui-grid-cell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ angular.module('ui.grid').directive('uiGridCell', ['$compile', '$parse', 'gridUt
2828
compiledElementFn($scope, function(clonedElement, scope) {
2929
$elm.append(clonedElement);
3030
});
31-
});
31+
}).catch(angular.noop);
3232
}
3333
else {
3434
var html = $scope.col.cellTemplate

src/js/core/directives/ui-grid-column-menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ function ($timeout, gridUtil, uiGridConstants, uiGridColumnMenuService, $documen
426426
.then(function () {
427427
$scope.grid.refresh();
428428
$scope.hideMenu();
429-
});
429+
}).catch(angular.noop);
430430
};
431431

432432
$scope.unsortColumn = function () {
@@ -480,7 +480,7 @@ function ($timeout, gridUtil, uiGridConstants, uiGridColumnMenuService, $documen
480480
//The fallback action is to focus on the grid menu
481481
return focusToGridMenu();
482482
}
483-
});
483+
}).catch(angular.noop);
484484
} else {
485485
// Fallback action to focus on the grid menu
486486
focusToGridMenu();

src/js/core/directives/ui-grid-footer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
containerCtrl.footerViewport = footerViewport;
3737
}
3838
}
39-
});
39+
}).catch(angular.noop);
4040
},
4141

4242
post: function ($scope, $elm, $attrs, controllers) {
@@ -62,4 +62,4 @@
6262
};
6363
}]);
6464

65-
})();
65+
})();

src/js/core/directives/ui-grid-grid-footer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
var newElm = $compile(template)($scope);
2626
$elm.append(newElm);
27-
});
27+
}).catch(angular.noop);
2828
},
2929

3030
post: function ($scope, $elm, $attrs, controllers) {
@@ -35,4 +35,4 @@
3535
};
3636
}]);
3737

38-
})();
38+
})();

src/js/core/directives/ui-grid-group-panel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
var newElm = $compile(template)($scope);
2222
$elm.append(newElm);
23-
});
23+
}).catch(angular.noop);
2424
},
2525

2626
post: function ($scope, $elm, $attrs, uiGridCtrl) {
@@ -33,4 +33,4 @@
3333
};
3434
}]);
3535

36-
})();
36+
})();

src/js/core/directives/ui-grid-header-cell.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
if ( $scope.colMenu ) {
120120
uiGridCtrl.columnMenuScope.showMenu($scope.col, $elm, event);
121121
}
122-
});
122+
}).catch(angular.noop);
123123

124124
uiGridCtrl.fireEvent(uiGridConstants.events.COLUMN_HEADER_CLICK, {event: event, columnName: $scope.col.colDef.name});
125125

@@ -350,7 +350,7 @@
350350
.then(function () {
351351
if (uiGridCtrl.columnMenuScope) { uiGridCtrl.columnMenuScope.hideMenu(); }
352352
uiGridCtrl.grid.refresh();
353-
});
353+
}).catch(angular.noop);
354354
};
355355

356356

src/js/core/directives/ui-grid-header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}
6060

6161
$scope.grid.queueRefresh();
62-
});
62+
}).catch(angular.noop);
6363

6464
function updateHeaderReferences() {
6565
containerCtrl.header = containerCtrl.colContainer.header = $elm;

src/js/core/directives/ui-grid-menu-button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ angular.module('ui.grid')
323323
menuItem.title = successValue;
324324
}, function( errorValue ) {
325325
menuItem.title = errorValue;
326-
});
326+
}).catch(angular.noop);
327327
} else {
328328
gridUtil.logError('Expected gridMenuTitleFilter to return a string or a promise, it has returned neither, bad config');
329329
menuItem.title = 'badconfig';

src/js/core/directives/ui-grid-menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
5050
var template = angular.element(contents);
5151
var newElm = $compile(template)($scope);
5252
$elm.replaceWith(newElm);
53-
});
53+
}).catch(angular.noop);
5454
}
5555

5656
var setupHeightStyle = function(gridHeight) {
@@ -248,7 +248,7 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
248248

249249
var newElm = $compile(template)($scope);
250250
$elm.replaceWith(newElm);
251-
});
251+
}).catch(angular.noop);
252252
}
253253
},
254254
post: function ($scope, $elm, $attrs, controllers) {

src/js/core/directives/ui-grid-row.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
clonedElement = newElm;
4747
cloneScope = newScope;
4848
});
49-
});
49+
}).catch(angular.noop);
5050
}
5151

5252
// Initially attach the compiled template to this scope
@@ -67,4 +67,4 @@
6767
};
6868
}]);
6969

70-
})();
70+
})();

src/js/core/directives/ui-grid.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
self.grid.preCompileCellTemplates();
3232

3333
self.grid.refreshCanvas(true);
34-
});
34+
}).catch(angular.noop);
3535
});
3636
}
3737

@@ -74,7 +74,7 @@
7474
self.grid.preCompileCellTemplates();
7575

7676
self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.COLUMN);
77-
});
77+
}).catch(angular.noop);
7878
}
7979
}
8080

@@ -118,7 +118,7 @@
118118
promises.push(self.grid.buildColumns()
119119
.then(function() {
120120
self.grid.preCompileCellTemplates();
121-
}));
121+
}).catch(angular.noop));
122122
}
123123

124124
$q.all(promises).then(function() {
@@ -133,8 +133,8 @@
133133
self.grid.refreshCanvas(true);
134134
self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.ROW);
135135
});
136-
});
137-
});
136+
}).catch(angular.noop);
137+
}).catch(angular.noop);
138138
}
139139
}
140140

src/js/core/factories/Grid.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,8 @@ angular.module('ui.grid')
795795
.then( function() {
796796
self.preCompileCellTemplates();
797797
self.queueGridRefresh();
798-
});
799-
});
798+
}).catch(angular.noop);
799+
}).catch(angular.noop);
800800
};
801801

802802
/**
@@ -913,7 +913,7 @@ angular.module('ui.grid')
913913
if (self.rows.length > 0){
914914
self.assignTypes();
915915
}
916-
});
916+
}).catch(angular.noop);
917917
};
918918

919919
Grid.prototype.preCompileCellTemplate = function(col) {
@@ -943,7 +943,7 @@ angular.module('ui.grid')
943943
} else if ( col.cellTemplatePromise ){
944944
col.cellTemplatePromise.then( function() {
945945
self.preCompileCellTemplate( col );
946-
});
946+
}).catch(angular.noop);
947947
}
948948
});
949949
};
@@ -1161,12 +1161,12 @@ angular.module('ui.grid')
11611161
var p1 = $q.when(self.processRowsProcessors(self.rows))
11621162
.then(function (renderableRows) {
11631163
return self.setVisibleRows(renderableRows);
1164-
});
1164+
}).catch(angular.noop);
11651165

11661166
var p2 = $q.when(self.processColumnsProcessors(self.columns))
11671167
.then(function (renderableColumns) {
11681168
return self.setVisibleColumns(renderableColumns);
1169-
});
1169+
}).catch(angular.noop);
11701170

11711171
return $q.all([p1, p2]);
11721172
};
@@ -1362,7 +1362,7 @@ angular.module('ui.grid')
13621362
else {
13631363
finished.resolve(processedRows);
13641364
}
1365-
});
1365+
}).catch(angular.noop);
13661366
}
13671367

13681368
// Start on the first processor
@@ -1490,7 +1490,7 @@ angular.module('ui.grid')
14901490
else {
14911491
finished.resolve(myRenderableColumns);
14921492
}
1493-
});
1493+
}).catch(angular.noop);
14941494
}
14951495

14961496
// Start on the first processor
@@ -1563,7 +1563,7 @@ angular.module('ui.grid')
15631563

15641564
self.refreshCanceller.then(function () {
15651565
self.refreshCanceller = null;
1566-
});
1566+
}).catch(angular.noop);
15671567

15681568
return self.refreshCanceller;
15691569
};
@@ -1588,7 +1588,7 @@ angular.module('ui.grid')
15881588

15891589
self.gridRefreshCanceller.then(function () {
15901590
self.gridRefreshCanceller = null;
1591-
});
1591+
}).catch(angular.noop);
15921592

15931593
return self.gridRefreshCanceller;
15941594
};
@@ -2068,17 +2068,17 @@ angular.module('ui.grid')
20682068

20692069
var p1 = self.processRowsProcessors(self.rows).then(function (renderableRows) {
20702070
self.setVisibleRows(renderableRows);
2071-
});
2071+
}).catch(angular.noop);
20722072

20732073
var p2 = self.processColumnsProcessors(self.columns).then(function (renderableColumns) {
20742074
self.setVisibleColumns(renderableColumns);
2075-
});
2075+
}).catch(angular.noop);
20762076

20772077
return $q.all([p1, p2]).then(function () {
20782078
self.redrawInPlace(rowsAltered);
20792079

20802080
self.refreshCanvas(true);
2081-
});
2081+
}).catch(angular.noop);
20822082
};
20832083

20842084
/**
@@ -2099,7 +2099,7 @@ angular.module('ui.grid')
20992099
self.redrawInPlace();
21002100

21012101
self.refreshCanvas( true );
2102-
});
2102+
}).catch(angular.noop);
21032103
};
21042104

21052105
/**

src/js/core/services/gridClassFactory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
function (res) {
3939
// Todo handle response error here?
4040
throw new Error("Couldn't fetch/use row template '" + grid.options.rowTemplate + "'");
41-
});
41+
}).catch(angular.noop);
4242
}
4343

4444
grid.registerColumnBuilder(service.defaultColumnBuilder);
@@ -119,7 +119,7 @@
119119
},
120120
function (res) {
121121
throw new Error("Couldn't fetch/use colDef." + templateType + " '" + colDef[templateType] + "'");
122-
})
122+
}).catch(angular.noop)
123123
);
124124

125125
};

src/js/core/services/ui-grid-util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
352352

353353
// See if the template is itself a promise
354354
if (angular.isFunction(template.then)) {
355-
return template.then(s.postProcessTemplate);
355+
return template.then(s.postProcessTemplate).catch(angular.noop);
356356
}
357357

358358
// If the template is an element, return the element
359359
try {
360360
if (angular.element(template).length > 0) {
361-
return $q.when(template).then(s.postProcessTemplate);
361+
return $q.when(template).then(s.postProcessTemplate).catch(angular.noop);
362362
}
363363
}
364364
catch (err){
@@ -380,7 +380,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
380380
throw new Error("Could not get template " + template + ": " + err);
381381
}
382382
)
383-
.then(s.postProcessTemplate);
383+
.then(s.postProcessTemplate).catch(angular.noop);
384384
},
385385

386386
//

0 commit comments

Comments
 (0)