mirror of https://github.com/status-im/js-waku.git
parent
6e22897f74
commit
a8e2b908ba
|
@ -107,7 +107,9 @@ export default function App() {
|
||||||
|
|
||||||
waku.relay.addObserver(handleRelayMessage, [ChatContentTopic]);
|
waku.relay.addObserver(handleRelayMessage, [ChatContentTopic]);
|
||||||
|
|
||||||
return;
|
return function cleanUp() {
|
||||||
|
waku?.relay.deleteObserver(handleRelayMessage, [ChatContentTopic]);
|
||||||
|
};
|
||||||
}, [waku]);
|
}, [waku]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -140,8 +142,7 @@ export default function App() {
|
||||||
handleProtocolChange.bind({}, waku)
|
handleProtocolChange.bind({}, waku)
|
||||||
);
|
);
|
||||||
|
|
||||||
// To clean up listener when component unmounts
|
return function cleanUp() {
|
||||||
return () => {
|
|
||||||
waku?.libp2p.peerStore.removeListener(
|
waku?.libp2p.peerStore.removeListener(
|
||||||
'change:protocols',
|
'change:protocols',
|
||||||
handleProtocolChange.bind({}, waku)
|
handleProtocolChange.bind({}, waku)
|
||||||
|
|
Loading…
Reference in New Issue