Closed lgommans closed 8 years ago
Tried a setTimeout(function(){DoSortingStuff}, 0) inside your loop?
Creating lots of timeouts should ensure that the browser can update the UI between them. This does make the operations happen out of order tho.
The whole thing is currently wrapped in a setTimeout, but it still freezes the UI for me. I forgot to mention another option: making a loop that does a little of the work every time (I knew I forgot something when posting this). Or is that what you're suggesting?
I just edited the post to include this. Thinking about it, that's the best solution actually.
Fixed in e238de1c5f8bc1f4caffb41ea349c340bc6d826d
This happens both when searching/filtering and when it auto-updates in the background.
Possible solutions:
1) Pagination -- this would probably work and speed up displaying the first results. Not sure what it does for UX.
2) Web workers -- prevents freezing but takes the same amount of time. Perhaps it can also show first results before it's completely finished, I'm not sure.
3) Split up the work and let the browser refresh in between -- prevents freezing, displays results quickly, and is probably also the most complicated.
4) Limit result count -- this is the workaround option if people mind it too much, until I can implement something better.