Commit 2a63f59
committed
fix(threads): thread drawer empty with classic sync
With classic sync, RoomViewHeader creates Thread objects via
room.createThread(id, rootEvent, [], false) — passing no initialEvents.
This means thread.events starts as just [rootEvent] (or empty).
Two bugs resulted:
1. The gate `if (fromThread.length > 0)` blocked the live-timeline fallback.
Since thread.events = [rootEvent], length was 1 (truthy), but after
filtering the root out the array was empty — yielding zero replies even
though the events were present in the main room timeline.
Fix: compute the filtered array first, then gate on its length so the
fallback is reached when the thread object has no actual replies yet.
2. Even after #1, subsequent renders and read-receipt logic used thread.events
(empty) rather than the live timeline.
Fix: add a mount-time useEffect that backfills matching events from the
unfiltered live timeline into the Thread object via thread.addEvents() so
the authoritative source is populated for future interactions.1 parent ab138a1 commit 2a63f59
1 file changed
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
401 | 428 | | |
402 | 429 | | |
403 | 430 | | |
| |||
484 | 511 | | |
485 | 512 | | |
486 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
487 | 519 | | |
488 | 520 | | |
489 | 521 | | |
490 | | - | |
491 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
492 | 527 | | |
493 | 528 | | |
494 | 529 | | |
| |||
0 commit comments