Commit 3146a71
committed
fix(sliding-sync): reset live timeline on reconnect to prevent event ordering corruption
When the sliding sync pos token expires (app backgrounded) and the server
re-sends initial:true for an already-open room, the SDK's processRoomData
treats any post-gap 'stranded' event as a known anchor and prepends gap-fill
events ahead of earlier history, producing out-of-order timelines
(Today -> Yesterday -> Today).
Register onInitialRoomData in the constructor and call slidingSync.on() in
attach() before mx.startClient() (i.e. before SlidingSyncSdk.onRoomData is
registered). When initial:true arrives for a room that already has events,
reset the live timeline so _eventIdToTimeline is cleared, all received events
go through the newEvents path, and chronological order is preserved.1 parent 9f45a73 commit 3146a71
1 file changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
280 | 287 | | |
281 | 288 | | |
282 | 289 | | |
| |||
425 | 432 | | |
426 | 433 | | |
427 | 434 | | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
428 | 446 | | |
429 | 447 | | |
430 | 448 | | |
| |||
474 | 492 | | |
475 | 493 | | |
476 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
477 | 499 | | |
478 | 500 | | |
479 | 501 | | |
| |||
513 | 535 | | |
514 | 536 | | |
515 | 537 | | |
| 538 | + | |
516 | 539 | | |
517 | 540 | | |
518 | 541 | | |
| |||
0 commit comments