Fix some JS warnings

This commit is contained in:
Gucheng Wang 2022-09-29 23:20:11 +08:00
parent f308fe932d
commit 62b058eb5e
8 changed files with 10 additions and 10 deletions

View File

@ -27,7 +27,7 @@ class AuthCallback extends React.Component {
};
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.login();
}

View File

@ -33,7 +33,7 @@ class SearchResultPage extends React.Component {
SearchBackend.search(this.state.keyword).then((res) => this.updateSearchResult(res));
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.props.history.listen((route) => {
const params = route.search.split("=");
if (params.length < 2) {

View File

@ -24,7 +24,7 @@ class SigninPage extends React.Component {
};
}
componentWillMount() {
UNSAFE_componentWillMount() {
Setting.goToLink(Setting.getSigninUrl());
}

View File

@ -150,7 +150,7 @@ class TopicPage extends React.Component {
renderTab(tab) {
return (
<a href="javascript:void(0)" onClick={() => this.changeTab(tab?.id)} className={this.state.tab === tab?.id ? "tab_current" : "tab"}>
<a key={tab?.id} href="javascript:void(0)" onClick={() => this.changeTab(tab?.id)} className={this.state.tab === tab?.id ? "tab_current" : "tab"}>
{tab?.name}
</a>
);

View File

@ -62,7 +62,7 @@ class NewBox extends React.Component {
};
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.getNodes();
MemberBackend.getMemberEditorType().then((res) => {
const editorType = res.data ? res.data : Conf.DefaultEditorType;

View File

@ -66,7 +66,7 @@ class NewNodeTopicBox extends React.Component {
this.publishTopic = this.publishTopic.bind(this);
}
componentWillMount() {
UNSAFE_componentWillMount() {
MemberBackend.getMemberEditorType().then((res) => {
const editorType = res.data ? res.data : Conf.DefaultEditorType;
this.updateFormField("editorType", editorType);

View File

@ -60,7 +60,7 @@ class NewReplyBox extends React.Component {
this.synonyms = this.synonyms.bind(this);
}
componentWillMount() {
UNSAFE_componentWillMount() {
MemberBackend.getMemberEditorType().then((res) => {
const editorType = res.data ? res.data : Conf.DefaultEditorType;
this.updateFormField("editorType", editorType);

View File

@ -42,7 +42,7 @@ class RightFavouriteBox extends React.Component {
renderNodes(node) {
return (
<div className="node rightFavorite">
<div key={node?.id} className="node rightFavorite">
<div className="node_compose rightFavorite">
<Link to={`/new/${node?.id}`} id="linkCompose">
<img src={Setting.getStatic("/img/compose.png")} align="absmiddle" border="0" width="23" height="18" alt="New Topic" />
@ -52,9 +52,9 @@ class RightFavouriteBox extends React.Component {
<div id="avatar" style={{backgroundImage: `url(${node?.image})`}} className="rightFavorite" />
</Link>
&nbsp;{" "}
<linkTitle to={`/go/${encodeURIComponent(node?.id)}`} id="linkTitle">
<span to={`/go/${encodeURIComponent(node?.id)}`} id="linkTitle">
{node?.name}
</linkTitle>
</span>
</div>
);
}