Changed the order of concating values
This commit is contained in:
parent
8afeb5916b
commit
aedb6a52d5
1 changed files with 2 additions and 2 deletions
|
|
@ -61,8 +61,8 @@ const RemoteSelect = inject('store')(
|
|||
};
|
||||
|
||||
function mergeOptions(oldOptions: SelectableValue[], newOptions: SelectableValue[]) {
|
||||
const existedValues = oldOptions.map((o) => o.value);
|
||||
return newOptions.filter(({ value }) => !existedValues.includes(value)).concat(oldOptions);
|
||||
const existingValues = oldOptions.map((o) => o.value);
|
||||
return oldOptions.concat(newOptions.filter(({ value }) => !existingValues.includes(value)));
|
||||
}
|
||||
|
||||
const [options, setOptions] = useReducer(mergeOptions, []);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue