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:
Timo K.
2026-11-26 17:51:02 +01:00
co-authored by Claude Opus 5.5
parent a96091411c
commit a50a7d19f2
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -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(),
+2 -2
View File
@@ -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]);
+1 -1
View File
@@ -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]);