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

@ -27,6 +27,13 @@ export default class UiItemList extends React.PureComponent<UiItemListProps> {
"A control is missing the \"type\" parameter"
);
}
if (control.type === "section") {
return(
<MqttContext.Consumer>
{this.renderListItem(control, key)}
</MqttContext.Consumer>
);
}
return (
<ListItem key={key}>
<MqttContext.Consumer>
@ -40,8 +47,7 @@ export default class UiItemList extends React.PureComponent<UiItemListProps> {
renderListItem(control: ControlUI, key: number) {
return (mqtt: MqttContextValue) => {
const node = this.renderControl(control, key.toString(), mqtt);
if (control.icon == null || control.type === "link"
|| control.type === "section") {
if (control.icon == null || control.type === "link") {
return node;
} else {
const listIconNode = (