When upgrading to select2 4.0.3 on NuGet, I came cross a problem where selected items all say “[object Object]”. I traced the problem down to this method: https://github.com/select2/select2/blob/master/src/js/select2/data/select.js#L246. It appears that you are checking if the passed-in data is an empty object, and if it is not, you re-assign it with a new one with id and text populated with the passed in data. Then, text and id are assigned as:
if (item.id != null) {
item.id = item.id.toString();
}
I think the solution is to not name the item you are initializing with the item passed in as a parameter, so the data isn’t overwritten. Then, it should just work. I’m prepared to submit a pull-request for this, should you want it.
. How soon do you expect 4.0.6 to be stable-released, and will it be posted on NuGet?
sweet! I’m not really sure but, maybe a month? The more people who can volunteer to use and test the pre-releases, the sooner we can find any regressions and declare them to be stable 