Debug logging

This commit is contained in:
Kegan Dougal 2024-09-16 09:34:14 +01:00
parent 797ef2d053
commit 8325c5934d

View file

@ -319,6 +319,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
} }
public componentDidMount(): void { public componentDidMount(): void {
console.log("componentDidMount");
if (this.props.manageReadReceipts) { if (this.props.manageReadReceipts) {
this.updateReadReceiptOnUserActivity(); this.updateReadReceiptOnUserActivity();
} }
@ -364,6 +365,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
} }
public componentWillUnmount(): void { public componentWillUnmount(): void {
console.log("componentWillUnmount");
// set a boolean to say we've been unmounted, which any pending // set a boolean to say we've been unmounted, which any pending
// promises can use to throw away their results. // promises can use to throw away their results.
// //
@ -704,6 +706,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
removed: boolean, removed: boolean,
data: IRoomTimelineData, data: IRoomTimelineData,
): void => { ): void => {
console.log("onRoomTimeline ", ev, room, "toStart:",toStartOfTimeline, "removed:",removed,"data:",data);
// ignore events for other timeline sets // ignore events for other timeline sets
if ( if (
data.timeline.getTimelineSet() !== this.props.timelineSet && data.timeline.getTimelineSet() !== this.props.timelineSet &&
@ -711,7 +714,6 @@ class TimelinePanel extends React.Component<IProps, IState> {
) { ) {
return; return;
} }
if (!Thread.hasServerSideSupport && this.context.timelineRenderingType === TimelineRenderingType.Thread) { if (!Thread.hasServerSideSupport && this.context.timelineRenderingType === TimelineRenderingType.Thread) {
if (toStartOfTimeline && !this.state.canBackPaginate) { if (toStartOfTimeline && !this.state.canBackPaginate) {
this.setState({ this.setState({
@ -810,6 +812,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
} }
private onRoomTimelineReset = (room: Room | undefined, timelineSet: EventTimelineSet): void => { private onRoomTimelineReset = (room: Room | undefined, timelineSet: EventTimelineSet): void => {
console.log("onRoomTimelineReset", room, timelineSet);
if (timelineSet !== this.props.timelineSet && timelineSet !== this.props.overlayTimelineSet) return; if (timelineSet !== this.props.timelineSet && timelineSet !== this.props.overlayTimelineSet) return;
if (this.canResetTimeline()) { if (this.canResetTimeline()) {
@ -1425,6 +1428,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
}; };
private initTimeline(props: IProps): void { private initTimeline(props: IProps): void {
console.log("initTimeline");
const initialEvent = props.eventId; const initialEvent = props.eventId;
const pixelOffset = props.eventPixelOffset; const pixelOffset = props.eventPixelOffset;
@ -1534,6 +1538,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
* @param {boolean?} scrollIntoView whether to scroll the event into view. * @param {boolean?} scrollIntoView whether to scroll the event into view.
*/ */
private loadTimeline(eventId?: string, pixelOffset?: number, offsetBase?: number, scrollIntoView = true): void { private loadTimeline(eventId?: string, pixelOffset?: number, offsetBase?: number, scrollIntoView = true): void {
console.log("loadTimeline");
const cli = MatrixClientPeg.safeGet(); const cli = MatrixClientPeg.safeGet();
this.timelineWindow = new TimelineWindow(cli, this.props.timelineSet, { windowLimit: this.props.timelineCap }); this.timelineWindow = new TimelineWindow(cli, this.props.timelineSet, { windowLimit: this.props.timelineCap });
this.overlayTimelineWindow = this.props.overlayTimelineSet this.overlayTimelineWindow = this.props.overlayTimelineSet
@ -1542,7 +1547,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
const onLoaded = (): void => { const onLoaded = (): void => {
if (this.unmounted) return; if (this.unmounted) return;
console.log("loadTimeline -> onLoaded");
// clear the timeline min-height when (re)loading the timeline // clear the timeline min-height when (re)loading the timeline
this.messagePanel.current?.onTimelineReset(); this.messagePanel.current?.onTimelineReset();
this.reloadEvents(); this.reloadEvents();
@ -1590,6 +1595,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
const onError = (error: MatrixError): void => { const onError = (error: MatrixError): void => {
if (this.unmounted) return; if (this.unmounted) return;
console.log("loadTimeline -> onError", error);
this.setState({ timelineLoading: false }); this.setState({ timelineLoading: false });
logger.error(`Error loading timeline panel at ${this.props.timelineSet.room?.roomId}/${eventId}`, error); logger.error(`Error loading timeline panel at ${this.props.timelineSet.room?.roomId}/${eventId}`, error);
@ -1644,7 +1650,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
onLoaded(); onLoaded();
return; return;
} }
console.log("calling timelineWindow.load");
const prom = this.timelineWindow.load(eventId, INITIAL_SIZE).then(async (): Promise<void> => { const prom = this.timelineWindow.load(eventId, INITIAL_SIZE).then(async (): Promise<void> => {
if (this.overlayTimelineWindow) { if (this.overlayTimelineWindow) {
// TODO: use timestampToEvent to load the overlay timeline // TODO: use timestampToEvent to load the overlay timeline
@ -1685,6 +1691,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
// get the list of events from the timeline windows and the pending event list // get the list of events from the timeline windows and the pending event list
private getEvents(): Pick<IState, "events" | "liveEvents"> { private getEvents(): Pick<IState, "events" | "liveEvents"> {
console.log("getEvents");
const mainEvents = this.timelineWindow!.getEvents(); const mainEvents = this.timelineWindow!.getEvents();
let overlayEvents = this.overlayTimelineWindow?.getEvents() ?? []; let overlayEvents = this.overlayTimelineWindow?.getEvents() ?? [];
if (this.props.overlayTimelineSetFilter !== undefined) { if (this.props.overlayTimelineSetFilter !== undefined) {