Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix warnings and rename unsafe lifecycle function #5814

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class App extends Component {
}
};

componentWillMount() {
UNSAFE_componentWillMount() {
if (!Utils.isDesktop()) {
this.setState({
isSidePanelClosed: true
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/common/search-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SearchInput extends Component {
}
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({searchValue: nextProps.value});
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dialog/delete-repo-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeleteRepoDialog extends Component {
};
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (!nextProps.isRepoDeleted) {
this.setState({isRequestSended: false});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SearchInput extends Component {
}
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({searchValue: nextProps.value});
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/dialog/rename-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Rename extends React.Component {
this.newInput = React.createRef();
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({newName: this.props.currentNode.object.name});
}

Expand All @@ -32,7 +32,7 @@ class Rename extends React.Component {
this.changeState(currentNode);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.changeState(nextProps.currentNode);
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/dialog/rename-dirent.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Rename extends React.Component {
this.newInput = React.createRef();
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.setState({newName: this.props.dirent.name});
}

Expand All @@ -32,7 +32,7 @@ class Rename extends React.Component {
this.changeState(dirent);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.changeState(nextProps.dirent);
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dir-view-mode/dir-column-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DirColumnNav extends React.Component {
this.isNodeMenuShow = true;
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.setState({opNode: nextProps.currentNode});
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dir-view-mode/dir-column-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class DirColumnView extends React.Component {
return '';
};

componentWillMount() {
UNSAFE_componentWillMount() {
let rate = this.getCookie('navRate');
if (rate) {
this.setState({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dirent-detail/dirent-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dirent-detail/lib-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/file-uploader/upload-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UploadListItem extends React.Component {
};
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let { resumableFile } = nextProps;
let uploadState = UPLOAD_UPLOADING;

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/index-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class IndexContentViewer extends React.Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.getRootNode();
}

componentDidMount() {
this.bindClickEvent();
}

componentWillReceiveProps() {
UNSAFE_componentWillReceiveProps() {
this.removeClickEvent();
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/seafile-codemirror/index.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/select-editor/select-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class SelectEditor extends React.Component {
});
};

componentWillReceiveProps() {
UNSAFE_componentWillReceiveProps() {
this.setOptions();
}

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/share-link-panel/link-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class UploadListItem extends React.Component {
};
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let { resumableFile } = nextProps;
let uploadState = UPLOAD_UPLOADING;

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/terms-preview-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TermsPreviewWidget extends React.Component {
}
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let mdFile = nextProps.content;
this.formatterLongTextValue(mdFile);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/tree-view/tree-node-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TreeNodeView extends React.Component {
}
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (!nextProps.isItemFreezed) {
this.setState({
isShowOperationMenu: false,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/wiki-markdown-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class WikiMarkdownViewer extends React.Component {
this.getTitlesInfo();
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.markdownContent === nextProps.markdownContent) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/wiki-outline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/groups/group-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class GroupView extends React.Component {
this.loadGroup(groupID);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.groupID !== this.props.groupID) {
this.loadGroup(nextProps.groupID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class LibContentContainer extends React.Component {
this.errMessage = (<div className="message err-tip">{gettext('Folder does not exist.')}</div>);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.path !== this.props.path || nextProps.updateDetail !== this.props.updateDetail) {
this.setState({currentDirent: null});
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class LibContentView extends React.Component {
});
};

componentWillMount() {
UNSAFE_componentWillMount() {
const hash = window.location.hash;
if (hash.slice(0, 1) === '#') {
this.setState({hash: hash});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/markdown-editor/seafile-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SeafileEditor extends React.Component {
window.seafileEditor = this;
}

componentWillMount() {
UNSAFE_componentWillMount() {
if (this.props.editorMode === 'rich') {
const document = this.state.richValue;
const firstNode = document[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class DevicesByPlatform extends Component {
this.state = {
loading: true,
errorMsg: '',
devicesData: {},
devicesData: [],
pageInfo: {},
perPage: 25
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/org-admin/input-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class OrgSamlConfigInput extends Component {
};
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.setState({value: nextProps.value,});
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/org-admin/main-panel-topbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Account from '../../components/common/account';

const propTypes = {
children: PropTypes.object,
search: PropTypes.string,
search: PropTypes.any,
};

class MainPanelTopbar extends Component {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/org-admin/org-department-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class OrgDepartmentItem extends React.Component {
this.listOrgMembers(groupID);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.groupID !== nextProps.groupID) {
this.listOrgGroupRepo(nextProps.groupID);
this.listOrgMembers(nextProps.groupID);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/org-admin/org-group-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Content.propTypes = {
};

OrgGroupInfo.propTypes = {
groupID: PropTypes.object.isRequired,
groupID: PropTypes.string,
};

export default OrgGroupInfo;
2 changes: 1 addition & 1 deletion frontend/src/pages/org-admin/org-group-members.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Item.propTypes = {
};

OrgGroupMembers.propTypes = {
groupID: PropTypes.object.isRequired,
groupID: PropTypes.string,
};

export default OrgGroupMembers;
2 changes: 1 addition & 1 deletion frontend/src/pages/org-admin/org-group-repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Item.propTypes = {
};

OrgGroupRepos.propTypes = {
groupID: PropTypes.object.isRequired,
groupID: PropTypes.string,
};

export default OrgGroupRepos;
2 changes: 1 addition & 1 deletion frontend/src/pages/org-admin/statistic/statistic-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class StatisticChart extends React.Component {
});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
let data = {
labels: nextProps.labels,
datasets: nextProps.filesData
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/repo-wiki-mode/side-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SidePanel extends Component {
this.isNodeMenuShow = true;
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.setState({opNode: nextProps.currentNode});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DepartmentDetail extends React.Component {
this.listGroupRepo(groupID);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.groupID !== nextProps.groupID) {
this.listGroupRepo(nextProps.groupID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DepartmentMembers extends React.Component {
});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.groupID !== nextProps.groupID) {
this.listMembers(nextProps.groupID, this.state.currentPage, this.state.perPage);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/sys-admin/departments/department.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Department extends React.Component {
this.getDepartmentInfo(groupID);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.groupID !== nextProps.groupID) {
this.getDepartmentInfo(nextProps.groupID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SubDepartments extends React.Component {
this.listSubDepartments(this.props.groupID);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.groupID !== nextProps.groupID) {
this.listSubDepartments(nextProps.groupID);
}
Expand Down
Loading
Loading