1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-12-05 15:22:09 +03:00

Conform more of the codebase to strictNullChecks (#11134)

This commit is contained in:
Michael Telatynski
2023-06-27 17:39:56 +01:00
committed by GitHub
parent 3d886de5b0
commit e1cad41bc3
15 changed files with 44 additions and 36 deletions

View File

@@ -599,7 +599,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
if (!this.timelineWindow?.canPaginate(dir)) {
debuglog("can't", dir, "paginate any further");
this.setState<null>({ [canPaginateKey]: false });
this.setState({ [canPaginateKey]: false } as Pick<IState, typeof canPaginateKey>);
return Promise.resolve(false);
}
@@ -609,7 +609,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
}
debuglog("Initiating paginate; backwards:" + backwards);
this.setState<null>({ [paginatingKey]: true });
this.setState({ [paginatingKey]: true } as Pick<IState, typeof paginatingKey>);
return this.onPaginationRequest(this.timelineWindow, dir, PAGINATE_SIZE).then(async (r) => {
if (this.unmounted) {
@@ -2012,7 +2012,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
return receiptStore?.getEventReadUpTo(myUserId, ignoreSynthesized) ?? null;
}
private setReadMarker(eventId: string | null, eventTs: number, inhibitSetState = false): void {
private setReadMarker(eventId: string | null, eventTs?: number, inhibitSetState = false): void {
const roomId = this.props.timelineSet.room?.roomId;
// don't update the state (and cause a re-render) if there is
@@ -2023,7 +2023,11 @@ class TimelinePanel extends React.Component<IProps, IState> {
// in order to later figure out if the read marker is
// above or below the visible timeline, we stash the timestamp.
TimelinePanel.roomReadMarkerTsMap[roomId ?? ""] = eventTs;
if (eventTs !== undefined) {
TimelinePanel.roomReadMarkerTsMap[roomId ?? ""] = eventTs;
} else {
delete TimelinePanel.roomReadMarkerTsMap[roomId ?? ""];
}
if (inhibitSetState) {
return;