From b942410caad67debdcb82801fdc39c6ad99a1fb7 Mon Sep 17 00:00:00 2001 From: Cory Lynch Date: Sun, 26 Apr 2020 18:49:24 -0400 Subject: [PATCH] OAuth: Remove socket listeners on unmount --- template/client/src/components/modules/OAuth.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/template/client/src/components/modules/OAuth.js b/template/client/src/components/modules/OAuth.js index de32c55..45b92d7 100644 --- a/template/client/src/components/modules/OAuth.js +++ b/template/client/src/components/modules/OAuth.js @@ -43,6 +43,12 @@ class OAuth extends Component { this.popup.close(); }); } + + componentWillUnmount() { + const { provider } = this.props; + socket.removeAllListeners(provider); + } + render() { const { provider } = this.props; @@ -55,4 +61,4 @@ class OAuth extends Component { } export default OAuth; -{{/auth.google}} \ No newline at end of file +{{/auth.google}}