add comment why we do things in this order

This commit is contained in:
Bruno Windels 2020-08-20 16:20:35 +02:00
parent 59bdd2b015
commit f5acee02be

View File

@ -132,7 +132,10 @@ export class GapWriter {
return RoomMember.fromMemberEvent(this._roomId, event)?.serialize(); return RoomMember.fromMemberEvent(this._roomId, event)?.serialize();
} }
} }
// look into newer events, but using prev_content if found // look into newer events, but using prev_content if found.
// We do this before looking into `state` because it is not well specified
// in the spec whether the events in there represent state before or after `chunk`.
// So we look both directions first in chunk to make sure it doesn't matter.
for (let i = index; i >= 0 && i < events.length; i -= inc) { for (let i = index; i >= 0 && i < events.length; i -= inc) {
const event = events[i]; const event = events[i];
if (isOurUser(event)) { if (isOurUser(event)) {