fix(plugin-data-viewer): double update on chunk size change

This commit is contained in:
Wroud
2020-09-09 15:07:40 +03:00
parent cec27939b1
commit 3cf9a62a7e
@@ -75,7 +75,16 @@ export const TableFooter = observer(function TableFooter({
}: TableFooterProps) {
const ref = useRef<HTMLInputElement>(null);
const handleChange = useCallback(
() => ref.current && model.setChunkSize(parseInt(ref.current.value, 10)),
() => {
if (!ref.current) {
return;
}
const value = parseInt(ref.current.value, 10);
if (model.getChunkSize() !== value) {
model.setChunkSize(value);
}
},
[model]
);