Skip to content

Angular 1.6 "Possibly unhandled rejection: canceled" fix. bug number #5890 #5949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/features/tree-base/js/tree-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@
if ( grid.options.treeRowHeaderAlwaysVisible === false && grid.treeBase.numberLevels <= 0 ){
newVisibility = false;
}
if ( rowHeader.visible !== newVisibility ) {
if ( rowHeader && rowHeader.visible !== newVisibility ) {
rowHeader.visible = newVisibility;
rowHeader.colDef.visible = newVisibility;
grid.queueGridRefresh();
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/directives/ui-grid-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ angular.module('ui.grid').directive('uiGridCell', ['$compile', '$parse', 'gridUt
compiledElementFn($scope, function(clonedElement, scope) {
$elm.append(clonedElement);
});
});
}).catch(angular.noop);
}
else {
var html = $scope.col.cellTemplate
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-column-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function ($timeout, gridUtil, uiGridConstants, uiGridColumnMenuService, $documen
.then(function () {
$scope.grid.refresh();
$scope.hideMenu();
});
}).catch(angular.noop);
};

$scope.unsortColumn = function () {
Expand Down Expand Up @@ -480,7 +480,7 @@ function ($timeout, gridUtil, uiGridConstants, uiGridColumnMenuService, $documen
//The fallback action is to focus on the grid menu
return focusToGridMenu();
}
});
}).catch(angular.noop);
} else {
// Fallback action to focus on the grid menu
focusToGridMenu();
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
containerCtrl.footerViewport = footerViewport;
}
}
});
}).catch(angular.noop);
},

post: function ($scope, $elm, $attrs, controllers) {
Expand All @@ -62,4 +62,4 @@
};
}]);

})();
})();
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-grid-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

var newElm = $compile(template)($scope);
$elm.append(newElm);
});
}).catch(angular.noop);
},

post: function ($scope, $elm, $attrs, controllers) {
Expand All @@ -35,4 +35,4 @@
};
}]);

})();
})();
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-group-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

var newElm = $compile(template)($scope);
$elm.append(newElm);
});
}).catch(angular.noop);
},

post: function ($scope, $elm, $attrs, uiGridCtrl) {
Expand All @@ -33,4 +33,4 @@
};
}]);

})();
})();
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-header-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
if ( $scope.colMenu ) {
uiGridCtrl.columnMenuScope.showMenu($scope.col, $elm, event);
}
});
}).catch(angular.noop);

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

Expand Down Expand Up @@ -350,7 +350,7 @@
.then(function () {
if (uiGridCtrl.columnMenuScope) { uiGridCtrl.columnMenuScope.hideMenu(); }
uiGridCtrl.grid.refresh();
});
}).catch(angular.noop);
};


Expand Down
2 changes: 1 addition & 1 deletion src/js/core/directives/ui-grid-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
}

$scope.grid.queueRefresh();
});
}).catch(angular.noop);

function updateHeaderReferences() {
containerCtrl.header = containerCtrl.colContainer.header = $elm;
Expand Down
2 changes: 1 addition & 1 deletion src/js/core/directives/ui-grid-menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ angular.module('ui.grid')
menuItem.title = successValue;
}, function( errorValue ) {
menuItem.title = errorValue;
});
}).catch(angular.noop);
} else {
gridUtil.logError('Expected gridMenuTitleFilter to return a string or a promise, it has returned neither, bad config');
menuItem.title = 'badconfig';
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18
var template = angular.element(contents);
var newElm = $compile(template)($scope);
$elm.replaceWith(newElm);
});
}).catch(angular.noop);
}

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

var newElm = $compile(template)($scope);
$elm.replaceWith(newElm);
});
}).catch(angular.noop);
}
},
post: function ($scope, $elm, $attrs, controllers) {
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
clonedElement = newElm;
cloneScope = newScope;
});
});
}).catch(angular.noop);
}

// Initially attach the compiled template to this scope
Expand All @@ -67,4 +67,4 @@
};
}]);

})();
})();
10 changes: 5 additions & 5 deletions src/js/core/directives/ui-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
self.grid.preCompileCellTemplates();

self.grid.refreshCanvas(true);
});
}).catch(angular.noop);
});
}

Expand Down Expand Up @@ -74,7 +74,7 @@
self.grid.preCompileCellTemplates();

self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.COLUMN);
});
}).catch(angular.noop);
}
}

Expand Down Expand Up @@ -118,7 +118,7 @@
promises.push(self.grid.buildColumns()
.then(function() {
self.grid.preCompileCellTemplates();
}));
}).catch(angular.noop));
}

$q.all(promises).then(function() {
Expand All @@ -133,8 +133,8 @@
self.grid.refreshCanvas(true);
self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.ROW);
});
});
});
}).catch(angular.noop);
}).catch(angular.noop);
}
}

Expand Down
28 changes: 14 additions & 14 deletions src/js/core/factories/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ angular.module('ui.grid')
.then( function() {
self.preCompileCellTemplates();
self.queueGridRefresh();
});
});
}).catch(angular.noop);
}).catch(angular.noop);
};

/**
Expand Down Expand Up @@ -913,7 +913,7 @@ angular.module('ui.grid')
if (self.rows.length > 0){
self.assignTypes();
}
});
}).catch(angular.noop);
};

Grid.prototype.preCompileCellTemplate = function(col) {
Expand Down Expand Up @@ -943,7 +943,7 @@ angular.module('ui.grid')
} else if ( col.cellTemplatePromise ){
col.cellTemplatePromise.then( function() {
self.preCompileCellTemplate( col );
});
}).catch(angular.noop);
}
});
};
Expand Down Expand Up @@ -1161,12 +1161,12 @@ angular.module('ui.grid')
var p1 = $q.when(self.processRowsProcessors(self.rows))
.then(function (renderableRows) {
return self.setVisibleRows(renderableRows);
});
}).catch(angular.noop);

var p2 = $q.when(self.processColumnsProcessors(self.columns))
.then(function (renderableColumns) {
return self.setVisibleColumns(renderableColumns);
});
}).catch(angular.noop);

return $q.all([p1, p2]);
};
Expand Down Expand Up @@ -1362,7 +1362,7 @@ angular.module('ui.grid')
else {
finished.resolve(processedRows);
}
});
}).catch(angular.noop);
}

// Start on the first processor
Expand Down Expand Up @@ -1490,7 +1490,7 @@ angular.module('ui.grid')
else {
finished.resolve(myRenderableColumns);
}
});
}).catch(angular.noop);
}

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

self.refreshCanceller.then(function () {
self.refreshCanceller = null;
});
}).catch(angular.noop);

return self.refreshCanceller;
};
Expand All @@ -1588,7 +1588,7 @@ angular.module('ui.grid')

self.gridRefreshCanceller.then(function () {
self.gridRefreshCanceller = null;
});
}).catch(angular.noop);

return self.gridRefreshCanceller;
};
Expand Down Expand Up @@ -2068,17 +2068,17 @@ angular.module('ui.grid')

var p1 = self.processRowsProcessors(self.rows).then(function (renderableRows) {
self.setVisibleRows(renderableRows);
});
}).catch(angular.noop);

var p2 = self.processColumnsProcessors(self.columns).then(function (renderableColumns) {
self.setVisibleColumns(renderableColumns);
});
}).catch(angular.noop);

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

self.refreshCanvas(true);
});
}).catch(angular.noop);
};

/**
Expand All @@ -2099,7 +2099,7 @@ angular.module('ui.grid')
self.redrawInPlace();

self.refreshCanvas( true );
});
}).catch(angular.noop);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/services/gridClassFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
function (res) {
// Todo handle response error here?
throw new Error("Couldn't fetch/use row template '" + grid.options.rowTemplate + "'");
});
}).catch(angular.noop);
}

grid.registerColumnBuilder(service.defaultColumnBuilder);
Expand Down Expand Up @@ -119,7 +119,7 @@
},
function (res) {
throw new Error("Couldn't fetch/use colDef." + templateType + " '" + colDef[templateType] + "'");
})
}).catch(angular.noop)
);

};
Expand Down
6 changes: 3 additions & 3 deletions src/js/core/services/ui-grid-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,13 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC

// See if the template is itself a promise
if (angular.isFunction(template.then)) {
return template.then(s.postProcessTemplate);
return template.then(s.postProcessTemplate).catch(angular.noop);
}

// If the template is an element, return the element
try {
if (angular.element(template).length > 0) {
return $q.when(template).then(s.postProcessTemplate);
return $q.when(template).then(s.postProcessTemplate).catch(angular.noop);
}
}
catch (err){
Expand All @@ -380,7 +380,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
throw new Error("Could not get template " + template + ": " + err);
}
)
.then(s.postProcessTemplate);
.then(s.postProcessTemplate).catch(angular.noop);
},

//
Expand Down