I have a web application that uses Knockout 3.4 and other libraries (inversifyJS, knockout.validation, axios, jQuery).
Since yesterday I have a huge performance issue while trying to fill a select-list asynchronous with axios and a knockout observable array.
Here is simplified jsfiddle that shows what I'm doing:
https://jsfiddle.net/m2r9Ljb2/3/
// Constructor for an object with two properties
var Country = function(name, population) {
this.email = name;
this.countryPopulation = population;
};
var viewModel = {
availableCountries : ko.observableArray([]),
selectedCountry : ko.observable() // Nothing selected by default
};
ko.applyBindings(viewModel);
$.getJSON('https://jsonplaceholder.typicode.com/comments', function( data ) {
ko.utils.arrayPushAll(viewModel.availableCountries, data);
})
If I run this code in jsfiddle it performs really fast. If I insert this code into my application it takes over 6 seconds before the UI is responsive again in IE11 and Firefox.
Nothing seems to help and I don't know what I can do anymore. I tried "Rate-limiting" and "Deferred updates" but nothing changes.
Does someone have an idea what the problem is? Is there something I can do to debug the problem? Why does it behave differently in jsfiddle?