@@ -194,22 +194,10 @@ export class RoomState extends TypedEventEmitter<EmittedEvents, EventHandlerMap>
194
194
* As the timeline might get reset while they are loading, this state needs to be inherited
195
195
* and shared when the room state is cloned for the new timeline.
196
196
* This should only be passed from clone.
197
- * @param isStartTimelineState - Optional. This state is marked as a start state.
198
- * This is used to skip state insertions that are
199
- * in the wrong order. The order is determined by the `replaces_state` id.
200
- *
201
- * Example:
202
- * A current state events `replaces_state` value is `1`.
203
- * Trying to insert a state event with `event_id` `1` in its place would fail if isStartTimelineState = false.
204
- *
205
- * A current state events `event_id` is `2`.
206
- * Trying to insert a state event where its `replaces_state` value is `2` would fail if isStartTimelineState = true.
207
197
*/
208
-
209
198
public constructor (
210
199
public readonly roomId : string ,
211
200
private oobMemberFlags = { status : OobStatus . NotStarted } ,
212
- public readonly isStartTimelineState = false ,
213
201
) {
214
202
super ( ) ;
215
203
this . updateModifiedTime ( ) ;
@@ -420,7 +408,7 @@ export class RoomState extends TypedEventEmitter<EmittedEvents, EventHandlerMap>
420
408
* Fires {@link RoomStateEvent.Events}
421
409
* Fires {@link RoomStateEvent.Marker}
422
410
*/
423
- public setStateEvents ( stateEvents : MatrixEvent [ ] , options ?: IMarkerFoundOptions ) : void {
411
+ public setStateEvents ( stateEvents : MatrixEvent [ ] , markerFoundOptions ?: IMarkerFoundOptions ) : void {
424
412
this . updateModifiedTime ( ) ;
425
413
426
414
// update the core event dict
@@ -432,22 +420,6 @@ export class RoomState extends TypedEventEmitter<EmittedEvents, EventHandlerMap>
432
420
}
433
421
434
422
const lastStateEvent = this . getStateEventMatching ( event ) ;
435
-
436
- // Safety measure to not update the room (and emit the update) with older state.
437
- // The sync loop really should not send old events but it does very regularly.
438
- // Logging on return in those two conditions results in a large amount of logging. (on startup and when running element)
439
- const lastReplaceId = lastStateEvent ?. event . unsigned ?. replaces_state ;
440
- const lastId = lastStateEvent ?. event . event_id ;
441
- const newReplaceId = event . event . unsigned ?. replaces_state ;
442
- const newId = event . event . event_id ;
443
- if ( this . isStartTimelineState ) {
444
- // Add an event to the start of the timeline. Its replace id should not be the same as the one of the current/last start state event.
445
- if ( newReplaceId && lastId && newReplaceId === lastId ) return ;
446
- } else {
447
- // Add an event to the end of the timeline. It should not be the same as the one replaced by the current/last end state event.
448
- if ( lastReplaceId && newId && lastReplaceId === newId ) return ;
449
- }
450
-
451
423
this . setStateEvent ( event ) ;
452
424
if ( event . getType ( ) === EventType . RoomMember ) {
453
425
this . updateDisplayNameCache ( event . getStateKey ( ) ! , event . getContent ( ) . displayname ?? "" ) ;
@@ -504,7 +476,7 @@ export class RoomState extends TypedEventEmitter<EmittedEvents, EventHandlerMap>
504
476
// assume all our sentinels are now out-of-date
505
477
this . sentinels = { } ;
506
478
} else if ( UNSTABLE_MSC2716_MARKER . matches ( event . getType ( ) ) ) {
507
- this . emit ( RoomStateEvent . Marker , event , options ) ;
479
+ this . emit ( RoomStateEvent . Marker , event , markerFoundOptions ) ;
508
480
}
509
481
} ) ;
510
482
0 commit comments