From de4e0cfcaa1ec9d5864bdc3180e8dcd76840c71b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 17 May 2022 14:12:11 +0100 Subject: [PATCH] Add extra TimelinePanel logging to debug specific issue (#8624) --- src/components/structures/TimelinePanel.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index 9cd88cf00e..0cd30b8f3a 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -383,7 +383,7 @@ class TimelinePanel extends React.Component { * every message change so instead we only log it out when asked. */ private onDumpDebugLogs = (): void => { - const roomId = this.props.timelineSet.room?.roomId; + const room = this.props.timelineSet.room; // Get a list of the event IDs used in this TimelinePanel. // This includes state and hidden events which we don't render const eventIdList = this.state.events.map((ev) => ev.getId()); @@ -408,8 +408,6 @@ class TimelinePanel extends React.Component { let serializedEventIdsFromTimelineSets: { [key: string]: string[] }[]; let serializedEventIdsFromThreadsTimelineSets: { [key: string]: string[] }[]; const serializedThreadsMap: { [key: string]: string[] } = {}; - const client = MatrixClientPeg.get(); - const room = client?.getRoom(roomId); if (room) { const timelineSets = room.getTimelineSets(); const threadsTimelineSets = room.threadsTimelineSets; @@ -424,15 +422,20 @@ class TimelinePanel extends React.Component { }); } + const timelineWindowEventIds = this.timelineWindow.getEvents().map(ev => ev.getId()); + const pendingEvents = this.props.timelineSet.getPendingEvents().map(ev => ev.getId()); + logger.debug( - `TimelinePanel(${this.context.timelineRenderingType}): Debugging info for ${roomId}\n` + + `TimelinePanel(${this.context.timelineRenderingType}): Debugging info for ${room?.roomId}\n` + `\tevents(${eventIdList.length})=${JSON.stringify(eventIdList)}\n` + - `\trenderedEventIds(${renderedEventIds ? renderedEventIds.length : 0})=` + + `\trenderedEventIds(${renderedEventIds?.length ?? 0})=` + `${JSON.stringify(renderedEventIds)}\n` + `\tserializedEventIdsFromTimelineSets=${JSON.stringify(serializedEventIdsFromTimelineSets)}\n` + `\tserializedEventIdsFromThreadsTimelineSets=` + `${JSON.stringify(serializedEventIdsFromThreadsTimelineSets)}\n` + - `\tserializedThreadsMap=${JSON.stringify(serializedThreadsMap)}`, + `\tserializedThreadsMap=${JSON.stringify(serializedThreadsMap)}\n` + + `\ttimelineWindowEventIds(${timelineWindowEventIds.length})=${JSON.stringify(timelineWindowEventIds)}\n` + + `\tpendingEvents(${pendingEvents.length})=${JSON.stringify(pendingEvents)}`, ); };