You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
I am exploring the Selectize codebase. I found this line inside refreshItems method: this.addItem(this.items);
I also found this line inside addItem method: value = hash_key(value);
since addItem method signature is function(value, silent), the value must be undefined, null, boolean, number, or string. If we feed addItem with array, value = hash_key(value); will produce incorrect value.
In addition to addItem, there is a corresponding method called addItems. There is no value = hash_key(value); statement (or anything similar) inside addItems. Moreover, addItem is called inside addItems: this.addItem(items[i], silent);.
Is it already correct (the this.addItem(this.items); statement inside refreshItems method),
or hidden bug (it should be this.addItems(this.items);)?
After reading more carefully, I found that this.addItem(this.items); will never be executed!
That statement is wrapped by if (this.isSetup), and refreshItems only called inside setup. The final value of if (this.isSetup) is ALWAYS false.
Moreover, of the 4 statements in refreshItems, only one is significant. the details are:
this.lastQuery = null; is unique and will be executed.
this.addItem(this.items, silent); is unique and will never be executed.
this.refreshState(); is NOT unique and will be executed.
this.updateOriginalInput({silent: silent}); is NOT unique and will be executed.
IMHO, the existence of refreshItems is redundant since it’s only called in one place, contains only a single meaningful statement, and adds unnecessary overhead.
Activity
the-liquid-metal commentedon Dec 10, 2025
After reading more carefully, I found that
this.addItem(this.items);will never be executed!That statement is wrapped by
if (this.isSetup), andrefreshItemsonly called insidesetup. The final value ofif (this.isSetup)is ALWAYSfalse.Moreover, of the 4 statements in
refreshItems, only one is significant. the details are:this.lastQuery = null;is unique and will be executed.this.addItem(this.items, silent);is unique and will never be executed.this.refreshState();is NOT unique and will be executed.this.updateOriginalInput({silent: silent});is NOT unique and will be executed.IMHO, the existence of
refreshItemsis redundant since it’s only called in one place, contains only a single meaningful statement, and adds unnecessary overhead.github-actions commentedon Apr 10, 2026
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days