1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

fix warnings and rename unsafe lifecycle function (#5814)

This commit is contained in:
Michael An
2023-12-06 17:24:05 +08:00
committed by GitHub
parent a9a8fea273
commit 429eecdd06
50 changed files with 89 additions and 91 deletions

View File

@@ -38,7 +38,7 @@ class SearchInput extends Component {
}
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({searchValue: nextProps.value});
}

View File

@@ -23,7 +23,7 @@ class DeleteRepoDialog extends Component {
};
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (!nextProps.isRepoDeleted) {
this.setState({isRequestSended: false});
}

View File

@@ -22,7 +22,7 @@ class SearchInput extends Component {
}
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({searchValue: nextProps.value});
}

View File

@@ -23,7 +23,7 @@ class Rename extends React.Component {
this.newInput = React.createRef();
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({newName: this.props.currentNode.object.name});
}
@@ -32,7 +32,7 @@ class Rename extends React.Component {
this.changeState(currentNode);
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.changeState(nextProps.currentNode);
}

View File

@@ -23,7 +23,7 @@ class Rename extends React.Component {
this.newInput = React.createRef();
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({newName: this.props.dirent.name});
}
@@ -32,7 +32,7 @@ class Rename extends React.Component {
this.changeState(dirent);
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.changeState(nextProps.dirent);
}

View File

@@ -54,7 +54,7 @@ class DirColumnNav extends React.Component {
this.isNodeMenuShow = true;
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.setState({opNode: nextProps.currentNode});
}

View File

@@ -135,7 +135,7 @@ class DirColumnView extends React.Component {
return '';
};
componentWillMount() {
UNSAFE_componentWillMount() {
let rate = this.getCookie('navRate');
if (rate) {
this.setState({

View File

@@ -36,7 +36,7 @@ class DirentDetail extends React.Component {
this.loadDirentInfo(dirent, path, repoID);
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let { dirent, path, repoID } = nextProps;
if (this.props.dirent !== nextProps.dirent) {
this.loadDirentInfo(dirent, path, repoID);

View File

@@ -26,7 +26,7 @@ class LibDetail extends React.Component {
this.getFileCounts(repo);
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.currentRepo.repo_id !== this.props.currentRepo.repo_id) {
this.getFileCounts(nextProps.currentRepo);
}

View File

@@ -42,7 +42,7 @@ class DirentGridItem extends React.Component {
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.setState({isGridSelected: false}, () => {
if (nextProps.activeDirent && nextProps.activeDirent.name === nextProps.dirent.name) {
this.setState({isGridSelected: true});

View File

@@ -95,7 +95,7 @@ class DirentListItem extends React.Component {
this.tagListTitleID = `tag-list-title-${uuidv4()}`;
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.isItemFreezed !== this.props.isItemFreezed && !nextProps.isItemFreezed) {
this.setState({
highlight: false,

View File

@@ -40,7 +40,7 @@ class ItemDropdownMenu extends React.Component {
this.setState({menuList: menuList});
}
componentWillReceiveProps(nextProps) { // for toolbar item operation
UNSAFE_componentWillReceiveProps(nextProps) { // for toolbar item operation
let { item } = nextProps;
if (item.name !== this.props.item.name) {
let menuList = this.props.getMenuList(item);

View File

@@ -23,7 +23,7 @@ class UploadListItem extends React.Component {
};
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let { resumableFile } = nextProps;
let uploadState = UPLOAD_UPLOADING;

View File

@@ -42,7 +42,7 @@ class IndexContentViewer extends React.Component {
};
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.getRootNode();
}
@@ -50,7 +50,7 @@ class IndexContentViewer extends React.Component {
this.bindClickEvent();
}
componentWillReceiveProps() {
UNSAFE_componentWillReceiveProps() {
this.removeClickEvent();
}

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import CodeMirror from '@uiw/react-codemirror';
import { EditorView } from "@codemirror/view"
import { EditorView } from '@codemirror/view';
import { loadLanguage } from '@uiw/codemirror-extensions-langs';
import { Utils } from '../../utils/utils';

View File

@@ -75,7 +75,7 @@ class SelectEditor extends React.Component {
});
};
componentWillReceiveProps() {
UNSAFE_componentWillReceiveProps() {
this.setOptions();
}

View File

@@ -9,7 +9,6 @@ import CommonOperationConfirmationDialog from '../../components/dialog/common-op
const propTypes = {
item: PropTypes.object.isRequired,
permissionOptions: PropTypes.array,
showLinkDetails : PropTypes.func.isRequired,
toggleSelectLink: PropTypes.func.isRequired,
deleteLink: PropTypes.func.isRequired
@@ -80,7 +79,7 @@ class LinkItem extends React.Component {
render() {
const { isItemOpVisible } = this.state;
const { item, permissionOptions } = this.props;
const { item } = this.props;
const { isSelected = false, permissions, link, expire_date } = item;
const currentPermission = Utils.getShareLinkPermissionStr(permissions);
return (

View File

@@ -23,7 +23,7 @@ class UploadListItem extends React.Component {
};
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let { resumableFile } = nextProps;
let uploadState = UPLOAD_UPLOADING;

View File

@@ -30,7 +30,7 @@ class TermsPreviewWidget extends React.Component {
}
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let mdFile = nextProps.content;
this.formatterLongTextValue(mdFile);
}

View File

@@ -44,7 +44,7 @@ class TreeNodeView extends React.Component {
}
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (!nextProps.isItemFreezed) {
this.setState({
isShowOperationMenu: false,

View File

@@ -43,7 +43,7 @@ class WikiMarkdownViewer extends React.Component {
this.getTitlesInfo();
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.markdownContent === nextProps.markdownContent) {
return;
}

View File

@@ -50,7 +50,7 @@ class WikiOutline extends React.Component {
};
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let _this = this;
let activeId = nextProps.activeId;
let navItems = nextProps.navItems;