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 Oct 2, 2019. It is now read-only.
I've recently upgraded ui-select from 0.9.6 to 0.9.9 and encountered the infamous "Duplicates in a repeater are not allowed" bug.
The bug only shows up if the ui-select is populated after the control is compiled - for example, if you're loading the values to bind from a server call. I've reproduced the problem here. In the script.js file you can change the value of SIMULATE_LOAD to false and you'll see the problem goes away, but when set as true and we're simulating a load from the server, you get the duplicates bug.
The bug was introduced in 0.9.8 in the following block of code:
var checkFnMultiple = function(list, value){
//if the list is empty add the value to the list
/***************************************************************/
/* THIS IS THE CODE THAT INTRODUCED THE BUG */
/***************************************************************/
if (!list || !list.length){
resultMultiple.unshift(value);
return true;
}
// Previously the code was:
// if (!list || !list.length) return;
/***************************************************************/
for (var p = list.length - 1; p >= 0; p--) {
locals[$select.parserResult.itemName] = list[p];
result = $select.parserResult.modelMapper(scope, locals);
if($select.parserResult.trackByExp){
var matches = /\.(.+)/.exec($select.parserResult.trackByExp);
if(matches.length>0 && result[matches[1]] == value[matches[1]]){
resultMultiple.unshift(list[p]);
return true;
}
}
if (result == value){
resultMultiple.unshift(list[p]);
return true;
}
}
return false;
};
Hope that helps!
The text was updated successfully, but these errors were encountered:
Thanks for this, I had no idea when this bug was introduced, so I was trying to patch this bug for my build. Reverting back to 0.9.7 seems to fix this problem!
Hi guys -
I've recently upgraded ui-select from 0.9.6 to 0.9.9 and encountered the infamous "Duplicates in a repeater are not allowed" bug.
The bug only shows up if the ui-select is populated after the control is compiled - for example, if you're loading the values to bind from a server call. I've reproduced the problem here. In the
script.js
file you can change the value ofSIMULATE_LOAD
tofalse
and you'll see the problem goes away, but when set as true and we're simulating a load from the server, you get the duplicates bug.The bug was introduced in 0.9.8 in the following block of code:
Hope that helps!
The text was updated successfully, but these errors were encountered: