mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
cancel sub on destroy
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
|||||||
EventType,
|
EventType,
|
||||||
RoomEvent as MatrixRoomEvent,
|
RoomEvent as MatrixRoomEvent,
|
||||||
} from "matrix-js-sdk/src/matrix";
|
} from "matrix-js-sdk/src/matrix";
|
||||||
import { BehaviorSubject, delay } from "rxjs";
|
import { BehaviorSubject, delay, Subscription } from "rxjs";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ElementCallReactionEventType,
|
ElementCallReactionEventType,
|
||||||
@@ -54,9 +54,11 @@ export class ReactionsReader {
|
|||||||
*/
|
*/
|
||||||
public readonly reactions$ = this.reactionsSubject$.asObservable();
|
public readonly reactions$ = this.reactionsSubject$.asObservable();
|
||||||
|
|
||||||
|
private readonly reactionsSub: Subscription;
|
||||||
|
|
||||||
public constructor(private readonly rtcSession: MatrixRTCSession) {
|
public constructor(private readonly rtcSession: MatrixRTCSession) {
|
||||||
// Hide reactions after a given time.
|
// Hide reactions after a given time.
|
||||||
this.reactionsSubject$
|
this.reactionsSub = this.reactionsSubject$
|
||||||
.pipe(delay(REACTION_ACTIVE_TIME_MS))
|
.pipe(delay(REACTION_ACTIVE_TIME_MS))
|
||||||
.subscribe((reactions) => {
|
.subscribe((reactions) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
@@ -332,5 +334,6 @@ export class ReactionsReader {
|
|||||||
MatrixRoomEvent.LocalEchoUpdated,
|
MatrixRoomEvent.LocalEchoUpdated,
|
||||||
this.handleReactionEvent,
|
this.handleReactionEvent,
|
||||||
);
|
);
|
||||||
|
this.reactionsSub.unsubscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user