Skip to content

Commit

Permalink
Fix jumping to read marker for events without tiles
Browse files Browse the repository at this point in the history
It is possible for your read marker to be set to an event without a tile (like a
reaction). We would still render the read marker at the position of those events
in the timeline, even though there's no matching tile, which breaks a core
assumption of jump to read marker path: it assumes that if the read marker node
is present in the DOM, then there must also be an event tile with a scroll token
matching the event ID.

This fixes the situation by no longer attempting to draw a read marker for
events without tiles.

Fixes element-hq/element-web#10975
  • Loading branch information
jryans committed Jun 25, 2020
1 parent fc61145 commit 78a93bd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/structures/MessagePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,14 @@ export default class MessagePanel extends React.Component {
// replacing all of the DOM elements every time we paginate.
ret.push(...this._getTilesForEvent(prevEvent, mxEv, last));
prevEvent = mxEv;
}

const readMarker = this._readMarkerForEvent(eventId, i >= lastShownNonLocalEchoIndex);
if (readMarker) ret.push(readMarker);
// Only consider drawing the read marker for events that also have a
// tile. When scrolling to the read marker, we assume that if the read
// marker node is present, then there is also an event tile with a
// matching scroll token as well.
const readMarker = this._readMarkerForEvent(eventId, i >= lastShownNonLocalEchoIndex);
if (readMarker) ret.push(readMarker);
}
}
}

Expand Down

0 comments on commit 78a93bd

Please sign in to comment.