From 57f4f9224474344417df960e517dc77e51321de5 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 22 Jan 2020 17:03:56 +1100 Subject: [PATCH] fix warning about no key being set for settings category list --- .../session/LeftPaneSettingSection.tsx | 71 ++++++++----------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/ts/components/session/LeftPaneSettingSection.tsx b/ts/components/session/LeftPaneSettingSection.tsx index 9270d3ff4..3062b556f 100644 --- a/ts/components/session/LeftPaneSettingSection.tsx +++ b/ts/components/session/LeftPaneSettingSection.tsx @@ -30,7 +30,6 @@ export class LeftPaneSettingSection extends React.Component { }; this.setCategory = this.setCategory.bind(this); - this.renderRows = this.renderRows.bind(this); } public componentDidMount() { @@ -62,53 +61,45 @@ export class LeftPaneSettingSection extends React.Component { ); } - public renderRows(): JSX.Element { - const categories = this.getCategories(); - + public renderRow(item: any): JSX.Element { return ( - <> - {categories.map(item => ( - <> - {!item.hidden && ( -
{ - this.setCategory(item.id); - }} - > -
- {item.title} -
- {item.description} -
- -
- {item.id === this.state.settingCategory && ( - - )} -
-
- )} - - ))} - +
{ + this.setCategory(item.id); + }} + > +
+ {item.title} +
+ {item.description} +
+ +
+ {item.id === this.state.settingCategory && ( + + )} +
+
); } public renderCategories(): JSX.Element { + const categories = this.getCategories().filter(item => !item.hidden); + return (
- {this.renderRows()} + {categories.map(item => this.renderRow(item))};
);