@jvilk opened this Issue on September 22nd 2017 Contributor

Problem

The piwikApiService class contains an array called allRequests that it appends to whenever the frontend makes an API request. However, it only clears this array if abortAll is called. Over a session with the Piwik dashboard, the array continues to grow as the frontend makes API requests.

Solution

allRequests should only contain active requests that have not yet completed, as it is only used by abortAll.

A simple solution is to remove requests when they complete. To do this, change line 170 to the following:

allRequests.push(request);
promise.finally(function() {
  var index = allRequests.indexOf(request);
  if (index !== -1) {
    allRequests.splice(index, 1);
  }
});
@tsteur commented on September 23rd 2017 Owner

Great suggestion. Do you mind issuing a pull request for this?

@jvilk commented on November 9th 2017 Contributor

PR issued and awaiting review!

Powered by GitHub Issue Mirror