Commit ef14a73
fix: use sparse patches for thread root metadata updates (#8829)
* frontend/chat: use sparse patches for thread root metadata updates
renameThread, setThreadPin, markThreadRead, and updateLastRead were
calling syncdb.set() with the entire message object (via toJS()),
round-tripping the history field through fromJS() on every update.
Since updateLastRead fires on every scroll (100ms throttle), this
continuously rewrote the thread root record — the most plausible
cause of the intermittent "first message content disappears" bug.
Refactor getThreadRootDoc → getThreadRootEntry to return only the
primary key fields (date, sender_id, event) plus the Immutable
message for reads. All callers now send sparse patches containing
only the primary keys and the changed field(s).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* frontend/chat: use calendar-day boundaries for thread recency buckets
Thread recency grouping ("Today", "Yesterday", etc.) used rolling 24h
windows instead of calendar-day boundaries, so threads from last night
could appear under "Today". Uses Date#setDate() for proper calendar
arithmetic that also handles DST transitions correctly.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent d711902 commit ef14a73
2 files changed
+59
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
| 566 | + | |
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
577 | 575 | | |
578 | 576 | | |
579 | 577 | | |
| |||
582 | 580 | | |
583 | 581 | | |
584 | 582 | | |
585 | | - | |
| 583 | + | |
586 | 584 | | |
587 | 585 | | |
588 | 586 | | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
595 | 591 | | |
596 | 592 | | |
597 | 593 | | |
| |||
608 | 604 | | |
609 | 605 | | |
610 | 606 | | |
611 | | - | |
| 607 | + | |
612 | 608 | | |
613 | 609 | | |
614 | 610 | | |
615 | | - | |
616 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
617 | 615 | | |
618 | 616 | | |
619 | 617 | | |
| |||
634 | 632 | | |
635 | 633 | | |
636 | 634 | | |
637 | | - | |
| 635 | + | |
638 | 636 | | |
639 | 637 | | |
640 | 638 | | |
641 | | - | |
| 639 | + | |
642 | 640 | | |
643 | 641 | | |
644 | 642 | | |
| |||
649 | 647 | | |
650 | 648 | | |
651 | 649 | | |
652 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
653 | 654 | | |
654 | 655 | | |
655 | 656 | | |
| |||
667 | 668 | | |
668 | 669 | | |
669 | 670 | | |
670 | | - | |
| 671 | + | |
671 | 672 | | |
672 | | - | |
| 673 | + | |
673 | 674 | | |
674 | 675 | | |
675 | 676 | | |
| |||
680 | 681 | | |
681 | 682 | | |
682 | 683 | | |
683 | | - | |
| 684 | + | |
684 | 685 | | |
685 | 686 | | |
686 | 687 | | |
| |||
691 | 692 | | |
692 | 693 | | |
693 | 694 | | |
694 | | - | |
| 695 | + | |
695 | 696 | | |
696 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
697 | 701 | | |
698 | 702 | | |
699 | 703 | | |
| |||
713 | 717 | | |
714 | 718 | | |
715 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
716 | 724 | | |
717 | 725 | | |
718 | 726 | | |
| |||
723 | 731 | | |
724 | 732 | | |
725 | 733 | | |
726 | | - | |
727 | | - | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
728 | 742 | | |
729 | 743 | | |
730 | 744 | | |
| |||
860 | 874 | | |
861 | 875 | | |
862 | 876 | | |
863 | | - | |
| 877 | + | |
864 | 878 | | |
865 | 879 | | |
866 | 880 | | |
| |||
1098 | 1112 | | |
1099 | 1113 | | |
1100 | 1114 | | |
1101 | | - | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1102 | 1120 | | |
1103 | 1121 | | |
1104 | 1122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | 166 | | |
168 | 167 | | |
169 | 168 | | |
| |||
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
191 | 190 | | |
192 | 191 | | |
193 | 192 | | |
| |||
211 | 210 | | |
212 | 211 | | |
213 | 212 | | |
214 | | - | |
215 | | - | |
| 213 | + | |
216 | 214 | | |
217 | 215 | | |
218 | 216 | | |
| |||
0 commit comments