mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 18:56:32 -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)
|
||||
|
||||
useEffect(() => {
|
||||
messageTransporter.doAsSoonAsReady(() => {
|
||||
const listener = messageTransporter.doAsSoonAsReady(() => {
|
||||
messageTransporter.sendMessage({
|
||||
type: MessageType.REALTIME_USER_SET_ACTIVITY,
|
||||
payload: {
|
||||
|
@ -29,5 +29,9 @@ export const useSendRealtimeActivity = (messageTransporter: MessageTransporter)
|
|||
}
|
||||
})
|
||||
})
|
||||
|
||||
return () => {
|
||||
listener.off()
|
||||
}
|
||||
}, [active, idling, messageTransporter])
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue