1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 11:01:14 +00:00

Merge pull request #7730 from haiwen/optimize/libcontent_view_unnecessary_render

remove redundant path reset, remove unsafe lifecycle method
This commit is contained in:
Michael An 2025-04-14 14:29:20 +08:00 committed by GitHub
commit 39f12f1279
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -221,14 +221,6 @@ class LibContentView extends React.Component {
}
};
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.repoID !== this.props.repoID) {
this.setState({ path: '/', viewId: '', tagID: '', currentMode: cookie.load('seafile_view_mode') || LIST_MODE }, () => {
this.calculatePara(nextProps);
});
}
}
calculatePara = async (props) => {
const { repoID } = props;
@ -343,7 +335,10 @@ class LibContentView extends React.Component {
this.socket.close();
}
componentDidUpdate() {
componentDidUpdate(prevProps) {
if (prevProps.repoID !== this.props.repoID) {
this.calculatePara(this.props);
}
this.lastModifyTime = new Date();
this.props.eventBus.dispatch(EVENT_BUS_TYPE.CURRENT_LIBRARY_CHANGED, {
repoID: this.props.repoID,