mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-10 03:17:39 +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:
commit
39f12f1279
@ -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) => {
|
calculatePara = async (props) => {
|
||||||
const { repoID } = props;
|
const { repoID } = props;
|
||||||
|
|
||||||
@ -343,7 +335,10 @@ class LibContentView extends React.Component {
|
|||||||
this.socket.close();
|
this.socket.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate(prevProps) {
|
||||||
|
if (prevProps.repoID !== this.props.repoID) {
|
||||||
|
this.calculatePara(this.props);
|
||||||
|
}
|
||||||
this.lastModifyTime = new Date();
|
this.lastModifyTime = new Date();
|
||||||
this.props.eventBus.dispatch(EVENT_BUS_TYPE.CURRENT_LIBRARY_CHANGED, {
|
this.props.eventBus.dispatch(EVENT_BUS_TYPE.CURRENT_LIBRARY_CHANGED, {
|
||||||
repoID: this.props.repoID,
|
repoID: this.props.repoID,
|
||||||
|
Loading…
Reference in New Issue
Block a user