vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.9k stars 6.97k forks source link

[Bug Report][3.7.4] v-autocomplete laggy when using "select all" #20703

Open clement-hyperplan opened 3 days ago

clement-hyperplan commented 3 days ago

Environment

Vuetify Version: 3.7.4 Vue Version: 3.5.13 Browsers: Chrome 130.0.0.0 OS: Mac OS 10.15.7

Steps to reproduce

Create a simple v-autocomplete with large number of items (here 5K)

Expected Behavior

On "Select all" click, all items should be active immediately.

Actual Behavior

App freezing for several seconds before doing so.

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

It works well with a virtual-scroller and v-list-items inside. Is there any reason it's laggy with autocomplete ? Is it due to component intern logic ? If so, is there any workaround for large sets of items like this one ?

Thank you in advance !

MatthewAry commented 3 days ago

VAutocomplete is an extension of VSelect. VSelect already uses a virtual scroller.. When you perform the select all operation, you replace the entire array which, from a vue perspective, is best thing you can do. It shows that there is room for improvement.

Some things that stood out after a cursory analysis on my part:

Its possible that by mapping over the entire model array, and doing join operations, and accessing nested properties within each value can cause problems. These are O(n) type operations and can slow things down.

I think there is legit room to improve.