mirror of
https://github.com/vector-im/element-call.git
synced 2026-11-28 10:01:09 +08:00
Remove the supplied client's listeners with off
The supplied client was asked for `on` and `removeListener`, while the call's backend asks the same client for `on` and `off`. Using `off` everywhere leaves one pair in what a host's client has to provide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a96091411c
commit
a50a7d19f2
@@ -20,7 +20,7 @@ import {
|
||||
const mockClient = (userId = "@alice:example.org"): MatrixClient =>
|
||||
({
|
||||
on: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
off: vi.fn(),
|
||||
getUserId: () => userId,
|
||||
getDeviceId: () => "AAAA",
|
||||
stopClient: vi.fn(),
|
||||
|
||||
@@ -170,7 +170,7 @@ export type SuppliedClient = Pick<
|
||||
MatrixClient,
|
||||
// The disconnected banner, and stopping a client opened elsewhere
|
||||
| "on"
|
||||
| "removeListener"
|
||||
| "off"
|
||||
| "stopClient"
|
||||
// Analytics, through `window.matrixclient`
|
||||
| "getCrypto"
|
||||
@@ -410,7 +410,7 @@ export const ClientProvider: FC<Props> = ({
|
||||
|
||||
return (): void => {
|
||||
if (initClientState.client) {
|
||||
initClientState.client.removeListener(ClientEvent.Sync, onSync);
|
||||
initClientState.client.off(ClientEvent.Sync, onSync);
|
||||
}
|
||||
};
|
||||
}, [initClientState, onSync, hostBridge]);
|
||||
|
||||
@@ -377,7 +377,7 @@ export function useRageshakeRequestModal(
|
||||
client.on(ClientEvent.Event, onEvent);
|
||||
|
||||
return (): void => {
|
||||
client.removeListener(ClientEvent.Event, onEvent);
|
||||
client.off(ClientEvent.Event, onEvent);
|
||||
};
|
||||
}, [setOpen, roomId, client]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user