Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix more detached DOM leaks (#10806)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed May 9, 2023
1 parent 84786ad commit bf641d1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/components/structures/AutoHideScrollbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export default class AutoHideScrollbar<T extends keyof JSX.IntrinsicElements> ex
if (this.containerRef.current && this.props.onScroll) {
this.containerRef.current.removeEventListener("scroll", this.props.onScroll);
}

this.props.wrappedRef?.(null);
}

public render(): React.ReactNode {
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {

// opaque readreceipt info for each userId; used by ReadReceiptMarker
// to manage its animations
private readonly readReceiptMap: { [userId: string]: IReadReceiptInfo } = {};
private readReceiptMap: { [userId: string]: IReadReceiptInfo } = {};

// Track read receipts by event ID. For each _shown_ event ID, we store
// the list of read receipts to display:
Expand Down Expand Up @@ -301,6 +301,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
this.isMounted = false;
this.props.room?.currentState.off(RoomStateEvent.Update, this.calculateRoomMembersCount);
SettingsStore.unwatchSetting(this.showTypingNotificationsWatcherRef);
this.readReceiptMap = {};
}

public componentDidUpdate(prevProps: IProps, prevState: IState): void {
Expand Down
4 changes: 3 additions & 1 deletion src/components/structures/ScrollPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default class ScrollPanel extends React.Component<IProps> {
private bottomGrowth: number;
private minListHeight: number;
private heightUpdateInProgress: boolean;
private divScroll: HTMLDivElement;
private divScroll: HTMLDivElement | null = null;

public constructor(props: IProps) {
super(props);
Expand Down Expand Up @@ -226,6 +226,8 @@ export default class ScrollPanel extends React.Component<IProps> {
this.unmounted = true;

this.props.resizeNotifier?.removeListener("middlePanelResizedNoisy", this.onResize);

this.divScroll = null;
}

private onScroll = (ev: Event): void => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ interface IState {
export class UnwrappedEventTile extends React.Component<EventTileProps, IState> {
private suppressReadReceiptAnimation: boolean;
private isListeningForReceipts: boolean;
private tile = React.createRef<IEventTileType>();
private replyChain = React.createRef<ReplyChain>();
private tile = createRef<IEventTileType>();
private replyChain = createRef<ReplyChain>();

public readonly ref = createRef<HTMLElement>();

Expand Down

0 comments on commit bf641d1

Please sign in to comment.