Use Throttling

This commit is contained in:
uwap 2018-07-22 05:17:47 +02:00
parent d3fc8d02c4
commit c18a2752af
4 changed files with 17 additions and 8 deletions

View file

@ -2,7 +2,7 @@
import React from "react";
import keys from "lodash/keys";
import map from "lodash/map";
import debounce from "lodash/debounce";
import throttle from "lodash/throttle";
import { renderRawIcon } from "config/icon";
import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction";
import ListItemText from "@material-ui/core/ListItemText";
@ -76,7 +76,7 @@ export class UiControl<I: UIControl> extends UiItem<I> {
this.debouncedChange(next);
}
debouncedChange = debounce((next: string) =>
debouncedChange = throttle((next: string) =>
this.props.onChangeState(this.props.item.topic, next), 50, {
leading: true,
trailing: true