Merge pull request #8211 from hsm-lv/fix-select

fix:Select值不变时不应触发change Close #8179
This commit is contained in:
hsm-lv 2023-09-22 17:25:06 +08:00 committed by GitHub
commit 18d98337fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -675,7 +675,10 @@ export class Select extends React.Component<SelectProps, SelectState> {
simpleValue ? selection.map(item => item[valueField]) : selection
);
} else {
onChange(simpleValue ? selectItem[valueField] : selectItem);
// Downshift里面的判断修改后的值是否相等时没有区分是否多选且用的是==,所以这里拦截一下
(!selection.length ||
selection[0][valueField] !== selectItem[valueField]) &&
onChange(simpleValue ? selectItem[valueField] : selectItem);
}
}