Avoid rerendering the list selection

[MAILPOET-2677]
This commit is contained in:
Amine Ben hammou
2020-03-24 17:22:54 +01:00
committed by Veljko V
parent 5bf85c4db6
commit 8c63228eaa

View File

@@ -18,7 +18,8 @@ export default (props: Props) => {
const idSelector = `#${id}`;
$(idSelector).select2();
$(idSelector).on('change', (e) => {
setValue(Array.from(e.target.selectedOptions).map((x: any) => x.value));
const value = Array.from(e.target.selectedOptions).map((x: any) => x.value);
setValue(value);
});
return () => $(idSelector).select2('destroy');
}, [id, setValue]);