1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-23 12:27:48 +00:00

[fix repo-update-toast bug] remove unnecessary listener&function (#2765)

This commit is contained in:
王健辉
2019-01-05 15:22:08 +08:00
committed by Daniel Pan
parent 797d0a6db2
commit 807a4c49a4
2 changed files with 4 additions and 3 deletions

View File

@@ -110,7 +110,7 @@ class DirView extends React.Component {
} }
componentWillUnmount() { componentWillUnmount() {
collabServer.unwatchRepo(this.props.repoID); collabServer.unwatchRepo(this.props.repoID, this.onRepoUpdateEvent);
} }
componentDidUpdate() { componentDidUpdate() {

View File

@@ -18,10 +18,10 @@ class CollabServer {
contact_email: contactEmail, contact_email: contactEmail,
}, },
}); });
socket.on('repo_update', fn) socket.on('repo_update', fn);
} }
unwatchRepo(repoID) { unwatchRepo(repoID, fn) {
if (!socket) { if (!socket) {
return; return;
} }
@@ -34,6 +34,7 @@ class CollabServer {
contact_email: contactEmail, contact_email: contactEmail,
}, },
}); });
socket.off('repo_update', fn);
} }
} }