mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
fix(frontend): fix event emitter leak in realtime status
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
b2cb54c225
commit
13a8eedb50
1 changed files with 5 additions and 1 deletions
|
@ -21,7 +21,7 @@ export const useSendRealtimeActivity = (messageTransporter: MessageTransporter)
|
||||||
const idling = useIdle(INACTIVITY_TIMEOUT_SECONDS * 1000)
|
const idling = useIdle(INACTIVITY_TIMEOUT_SECONDS * 1000)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
messageTransporter.doAsSoonAsReady(() => {
|
const listener = messageTransporter.doAsSoonAsReady(() => {
|
||||||
messageTransporter.sendMessage({
|
messageTransporter.sendMessage({
|
||||||
type: MessageType.REALTIME_USER_SET_ACTIVITY,
|
type: MessageType.REALTIME_USER_SET_ACTIVITY,
|
||||||
payload: {
|
payload: {
|
||||||
|
@ -29,5 +29,9 @@ export const useSendRealtimeActivity = (messageTransporter: MessageTransporter)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
listener.off()
|
||||||
|
}
|
||||||
}, [active, idling, messageTransporter])
|
}, [active, idling, messageTransporter])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue