mirror of https://github.com/vector-im/riot-web
Fix room history not being visible even if we have historical keys (#8563)
parent
00984e4434
commit
13aa610cd2
|
@ -24,7 +24,7 @@ import { TimelineWindow } from "matrix-js-sdk/src/timeline-window";
|
||||||
import { EventType, RelationType } from 'matrix-js-sdk/src/@types/event';
|
import { EventType, RelationType } from 'matrix-js-sdk/src/@types/event';
|
||||||
import { SyncState } from 'matrix-js-sdk/src/sync';
|
import { SyncState } from 'matrix-js-sdk/src/sync';
|
||||||
import { RoomMember, RoomMemberEvent } from 'matrix-js-sdk/src/models/room-member';
|
import { RoomMember, RoomMemberEvent } from 'matrix-js-sdk/src/models/room-member';
|
||||||
import { debounce } from 'lodash';
|
import { debounce, throttle } from 'lodash';
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { ClientEvent } from "matrix-js-sdk/src/client";
|
import { ClientEvent } from "matrix-js-sdk/src/client";
|
||||||
import { Thread } from 'matrix-js-sdk/src/models/thread';
|
import { Thread } from 'matrix-js-sdk/src/models/thread';
|
||||||
|
@ -808,16 +808,20 @@ class TimelinePanel extends React.Component<IProps, IState> {
|
||||||
// Can be null for the notification timeline, etc.
|
// Can be null for the notification timeline, etc.
|
||||||
if (!this.props.timelineSet.room) return;
|
if (!this.props.timelineSet.room) return;
|
||||||
|
|
||||||
|
if (ev.getRoomId() !== this.props.timelineSet.room.roomId) return;
|
||||||
|
|
||||||
|
if (!this.state.events.includes(ev)) return;
|
||||||
|
|
||||||
|
this.recheckFirstVisibleEventIndex();
|
||||||
|
|
||||||
// Need to update as we don't display event tiles for events that
|
// Need to update as we don't display event tiles for events that
|
||||||
// haven't yet been decrypted. The event will have just been updated
|
// haven't yet been decrypted. The event will have just been updated
|
||||||
// in place so we just need to re-render.
|
// in place so we just need to re-render.
|
||||||
// TODO: We should restrict this to only events in our timeline,
|
// TODO: We should restrict this to only events in our timeline,
|
||||||
// but possibly the event tile itself should just update when this
|
// but possibly the event tile itself should just update when this
|
||||||
// happens to save us re-rendering the whole timeline.
|
// happens to save us re-rendering the whole timeline.
|
||||||
if (ev.getRoomId() === this.props.timelineSet.room.roomId) {
|
|
||||||
this.buildCallEventGroupers(this.state.events);
|
this.buildCallEventGroupers(this.state.events);
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private onSync = (clientSyncState: SyncState, prevState: SyncState, data: object): void => {
|
private onSync = (clientSyncState: SyncState, prevState: SyncState, data: object): void => {
|
||||||
|
@ -825,6 +829,13 @@ class TimelinePanel extends React.Component<IProps, IState> {
|
||||||
this.setState({ clientSyncState });
|
this.setState({ clientSyncState });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private recheckFirstVisibleEventIndex = throttle((): void => {
|
||||||
|
const firstVisibleEventIndex = this.checkForPreJoinUISI(this.state.events);
|
||||||
|
if (firstVisibleEventIndex !== this.state.firstVisibleEventIndex) {
|
||||||
|
this.setState({ firstVisibleEventIndex });
|
||||||
|
}
|
||||||
|
}, 500, { leading: true, trailing: true });
|
||||||
|
|
||||||
private readMarkerTimeout(readMarkerPosition: number): number {
|
private readMarkerTimeout(readMarkerPosition: number): number {
|
||||||
return readMarkerPosition === 0 ?
|
return readMarkerPosition === 0 ?
|
||||||
this.context?.readMarkerInViewThresholdMs ?? this.state.readMarkerInViewThresholdMs :
|
this.context?.readMarkerInViewThresholdMs ?? this.state.readMarkerInViewThresholdMs :
|
||||||
|
|
Loading…
Reference in New Issue