fix: componentWillReceiveProps api and key in jsx (#551)

* fix: componentWillReceiveProps api and key in jsx

* fix: componentWillReceiveProps api and key in jsx

* fix: revert the app.conf file

* fix: revert the app.conf file
This commit is contained in:
kcfuler 2022-10-02 10:13:02 +08:00 committed by GitHub
parent ef70126b37
commit 9ac71d98a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 29 additions and 29 deletions

View File

@ -377,7 +377,7 @@ class Header extends React.Component {
{this.state.matchNodes.map((val) => {
// TODO: maybe weshould add `active` iterm
return (
<a className="search-item" href={`/go/${val.id}`}>
<a className="search-item" href={`/go/${val.id}`} key={val.id}>
{val.name}&nbsp;&nbsp;/&nbsp;&nbsp;{val.id}
</a>
);

View File

@ -193,7 +193,7 @@ class AdminFrontConf extends React.Component {
<tbody>
{this.state.conf.map((item) => {
return (
<tr>
<tr key={item.id}>
<td width={Setting.PcBrowser ? "120" : "90"} align="right">
{this.convert(item.id)}
</td>

View File

@ -67,7 +67,7 @@ class AdminNode extends React.Component {
this.getPlanes();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
this.setState(
{
@ -356,7 +356,7 @@ class AdminNode extends React.Component {
{i18next.t("error:Please resolve the following issues before submitting")}
<ul>
{problems.map((problem, i) => {
return <li>{problem}</li>;
return <li key={i}>{problem}</li>;
})}
</ul>
</div>

View File

@ -52,7 +52,7 @@ class AdminPlane extends React.Component {
this.getPlanes();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
this.setState(
{
@ -310,7 +310,7 @@ class AdminPlane extends React.Component {
{i18next.t("error:Please resolve the following issues before submitting")}
<ul>
{problems.map((problem, i) => {
return <li>{problem}</li>;
return <li key={i}>{problem}</li>;
})}
</ul>
</div>

View File

@ -45,7 +45,7 @@ class AdminTab extends React.Component {
this.getTabs();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
this.setState(
{
@ -246,7 +246,7 @@ class AdminTab extends React.Component {
{i18next.t("error:Please resolve the following issues before submitting")}
<ul>
{problems.map((problem, i) => {
return <li>{problem}</li>;
return <li key={i}>{problem}</li>;
})}
</ul>
</div>

View File

@ -82,7 +82,7 @@ class AdminTopic extends React.Component {
this.getTopic();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -67,7 +67,7 @@ class AllCreatedTopicsBox extends React.Component {
this.getMember();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -54,7 +54,7 @@ class BalanceBox extends React.Component {
this.getRecords();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -53,7 +53,7 @@ class FavoritesBox extends React.Component {
this.getFavoritesInfo();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -65,7 +65,7 @@ class FilesBox extends React.Component {
this.getFileNum();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");
@ -241,9 +241,9 @@ class FilesBox extends React.Component {
});
}
renderUploadFile(file) {
renderUploadFile(file, index) {
return (
<div className="cell">
<div className="cell" key={index}>
<table cellPadding="0" cellSpacing="0" border="0" width="100%">
<tbody>
<tr>
@ -301,7 +301,7 @@ class FilesBox extends React.Component {
<div className="cell">
<span className="gray">{i18next.t("file:Uploaded file")}</span>
</div>
{this.state.files?.map((file) => this.renderUploadFile(file))}
{this.state.files?.map((file, index) => this.renderUploadFile(file, index))}
</div>
<div className="cell">
<div className="fr" style={{paddingTop: "2px"}}>
@ -515,7 +515,7 @@ class FilesBox extends React.Component {
return (
<div className="problem" onClick={() => this.clearMessage()}>
{problems.map((problem, i) => {
return <li>{problem}</li>;
return <li key={i}>{problem}</li>;
})}
</div>
);

View File

@ -57,7 +57,7 @@ class LatestReplyBox extends React.Component {
this.getRepliesNum();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -42,7 +42,7 @@ class MemberBox extends React.Component {
this.getFavoriteStatus();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
this.setState(
{

View File

@ -228,7 +228,7 @@ class NewBox extends React.Component {
{i18next.t("error:Please resolve the following issues before creating a new topic")}
<ul>
{problems.map((problem, i) => {
return <li>{problem}</li>;
return <li key={i}>{problem}</li>;
})}
{this.state.message !== "" ? <li>{i18next.t(`error:${this.state.message}`)}</li> : null}
</ul>

View File

@ -119,7 +119,7 @@ class NewReplyBox extends React.Component {
{i18next.t("reply:Please resolve the following issues before submitting")}
<ul>
{problems.map((problem, i) => {
return <li>{problem}</li>;
return <li key={i}>{problem}</li>;
})}
</ul>
</div>

View File

@ -67,7 +67,7 @@ class NodeBox extends React.Component {
NodeBackend.addNodeBrowseCount(this.state.nodeId);
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -56,7 +56,7 @@ class NotificationBox extends React.Component {
this.getNotifications();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -42,7 +42,7 @@ class PageColumn extends React.Component {
}
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.page !== this.props.page) {
this.getMaxPage();
}

View File

@ -70,7 +70,7 @@ class RankingPlayerBox extends React.Component {
<table cellPadding="10" cellSpacing="0" border="0" width="100%">
{this.state.playerList
? this.state.playerList.map((member, key) => (
<tr>
<tr key={key}>
<td width={Setting.PcBrowser ? "65" : "36"} valign="top" align="center" key={key}>
<Avatar username={member.name} avatar={member.avatar} key={key} />
</td>

View File

@ -77,7 +77,7 @@ class RankingRichBox extends React.Component {
<table cellPadding="10" cellSpacing="0" border="0" width="100%">
{this.state.richList
? this.state.richList.map((member, key) => (
<tr>
<tr key={key}>
<td width={Setting.PcBrowser ? "73" : "36"} valign="top" align="center" key={key}>
<Avatar username={member.name} avatar={member.avatar} key={key} />
</td>

View File

@ -51,7 +51,7 @@ class RecentTopicsBox extends React.Component {
this.getTopics();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
let page = params.get("p");

View File

@ -99,7 +99,7 @@ class ReplyBox extends React.Component {
}
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
const params = new URLSearchParams(newProps.location.search);
const page = params.get("p");

View File

@ -77,7 +77,7 @@ class TopicBox extends React.Component {
this.props.getNodeBackground("", "", "", "");
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.location !== this.props.location) {
if (this.judgeAnchorElement()) {
return;