Choices: unhighlightAll in Click handler causes click performance issue on large lists.

Created on 18 Feb 2019  路  4Comments  路  Source: Choices-js/Choices

If working with a large chosen list (2000+ items), unhighlightAll is called for every click on the page when the select is inactive. It causes very noticeable click performance delays.

Didn't dig to far to see why it is called there, butIi didn't notice any issues with the select after i removed it form the click handler.

need more info

Most helpful comment

I actually can't get it to reproduce in an ultra basic fiddle. Admin it's being used in is also using some pjax binding, maybe two things compounding. I took a look at the source and see you have a check wrapped around it in the source.

As I mentioned above I removed the
&&this.unhighlightAll()
in the minified bundle and the problem went away. That hack is good enough to take care of my issue so i'm gonna close this.

All 4 comments

@jchamb Could you provide a js fiddle please highlighting the problem please?

I actually can't get it to reproduce in an ultra basic fiddle. Admin it's being used in is also using some pjax binding, maybe two things compounding. I took a look at the source and see you have a check wrapped around it in the source.

As I mentioned above I removed the
&&this.unhighlightAll()
in the minified bundle and the problem went away. That hack is good enough to take care of my issue so i'm gonna close this.

I was running into the same issue where I have over 9000 items.

image

Changing an input that is not Choices triggers the slowdown, so i think the click handler listens to all input elements instead of the one it's bound to.

Like @jchamb suggested, removing &&this.unhighlightAll() from the minified version removes the slowdown.

@jchamb I tried to reomve all highlightAll() and unhighlightAll() but the green box and highlight functionality still exist, and the slowness still occur.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kjugi picture kjugi  路  3Comments

alfonsoar picture alfonsoar  路  4Comments

NetanelBasal picture NetanelBasal  路  6Comments

sebastien-roch picture sebastien-roch  路  3Comments

ggcaponetto picture ggcaponetto  路  4Comments