Skip to content
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

$rootScope.$apply() and terrible performance with multiple files #687

Closed
maurycyg opened this issue Nov 3, 2016 · 3 comments
Closed

$rootScope.$apply() and terrible performance with multiple files #687

maurycyg opened this issue Nov 3, 2016 · 3 comments

Comments

@maurycyg
Copy link

maurycyg commented Nov 3, 2016

I've an application where I use file uploader 2.3.4 at some point, I noticed a drop in performance while a list of just 50 items was loaded at the same time. After digging a bit I found that this line is called https:/nervgh/angular-file-upload/blame/master/src/services/FileUploader.js#L342 causing ALL the watchers to be fired way too often. This should be handled differently. In my case, I could remove the _render as uploader renders properly and now adding 300+ files has no hiccups

@nervgh
Copy link
Owner

nervgh commented Nov 28, 2016

You could just override the _render method:

let uploader = new FileUploader(/* options */);

uploader._render = function() {
    // $scope is your scope
    if(!$scope.$$phase) $scope.$apply();
};

Also you could improve docs about performance issues.

@nervgh
Copy link
Owner

nervgh commented Nov 28, 2016

@maurycyg
Copy link
Author

Thanks, I'll create extended document on the performance

@nervgh nervgh closed this as completed Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants