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

Fixed the bug that the lock button is displayed only when the page is refreshed (#7102)

This commit is contained in:
杨顺强
2024-11-25 18:13:08 +08:00
committed by GitHub
parent c16e560ff7
commit 4093c27ed7

View File

@@ -117,7 +117,8 @@ class DirentListItem extends React.Component {
} }
UNSAFE_componentWillReceiveProps(nextProps) { UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.dirent && this.state.dirent && nextProps.dirent.name !== this.state.dirent.name) { if (nextProps.dirent && this.state.dirent) {
if (nextProps.dirent.name !== this.state.dirent.name) {
this.setState({ this.setState({
dirent: nextProps.dirent, dirent: nextProps.dirent,
}, () => { }, () => {
@@ -132,6 +133,14 @@ class DirentListItem extends React.Component {
} }
}); });
} }
if (
nextProps.dirent.is_locked !== this.state.dirent.is_locked ||
nextProps.dirent.starred !== this.state.dirent.starred
) {
this.setState({ dirent: nextProps.dirent });
}
}
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {