-
Bug
-
Resolution: Fixed
-
Minor
-
3.5.2
-
-
MOODLE_35_STABLE
-
MOODLE_36_STABLE
-
Moodle Mobile 3.6.0
In our controllers we usually define infinite loading logic like this:
$scope.loadMoreNotifications = function(){
|
fetchNotifications().finally(function() {
|
$scope.$broadcast('scroll.infiniteScrollComplete');
|
});
|
};
|
There's a problem with this approach: if the fetch request fails and the data is not cached, we end up with infinite failed calls to WS, because once we broadcast 'scroll.infiniteScrollComplete' the request is performed again.
The easy way to fix it would be setting this if the request fails:
$scope.canLoadMore = false;
|
This'll make infinite-loading to disappear forever, so the user'll have to do a pull to refresh or something to re-enable it.
Another option would be to replace the infinite-loading with a "Load more" button if a request fails. That way we stop the infinite executions and we still allow the user to retry it. If the user clicks "Load more" and the request succeeds, we'd show the infinite-loading again.