Commit f51c90c
committed
fix(conversations): guard optimistic list actions against stale syncs
The conversation list actions - mark as read/unread (menu and swipe),
add to or remove from favorites, and tag assignment - write the local
conversation entry optimistically and revert on server failure, but had
no protection against the same race the read marker had: a room list
sync (or single-room refresh) whose response was computed before the
action reached the server reverts the entry to the old state until the
next sync, flipping badges and jumping favorite-sorted rows.
Generalize the pending read marker mechanism in ConversationListUpdater
to these actions: each optimistic write registers a pending change, and
while the server response provably doesn't reflect it yet, the local
state is kept in the merge. Once the server confirms the change it is
released and the server state applies unchanged - so changes made on
other devices keep flowing - and a failed action releases its pending
change when reverting, restoring the server's authority. Mark-as-read
reuses the pending read marker itself; mark-as-unread, favorites and
tags get their own pending state with value-based confirmation.
Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>1 parent 3f71b0d commit f51c90c
5 files changed
Lines changed: 204 additions & 31 deletions
File tree
- app/src
- main/java/com/nextcloud/talk
- conversationlist
- data/network
- viewmodels
- conversationtags/viewmodels
- test/java/com/nextcloud/talk/conversationlist/data/network
Lines changed: 122 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
48 | 65 | | |
49 | 66 | | |
50 | 67 | | |
51 | 68 | | |
52 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
53 | 102 | | |
54 | 103 | | |
55 | 104 | | |
| |||
80 | 129 | | |
81 | 130 | | |
82 | 131 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
91 | 140 | | |
92 | | - | |
| 141 | + | |
93 | 142 | | |
94 | 143 | | |
95 | 144 | | |
96 | 145 | | |
97 | | - | |
98 | | - | |
99 | 146 | | |
100 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
101 | 203 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
116 | 212 | | |
| 213 | + | |
117 | 214 | | |
118 | 215 | | |
119 | 216 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
80 | | - | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
714 | 716 | | |
715 | 717 | | |
716 | 718 | | |
| 719 | + | |
717 | 720 | | |
718 | 721 | | |
719 | 722 | | |
| |||
723 | 726 | | |
724 | 727 | | |
725 | 728 | | |
| 729 | + | |
726 | 730 | | |
727 | 731 | | |
728 | 732 | | |
| |||
741 | 745 | | |
742 | 746 | | |
743 | 747 | | |
| 748 | + | |
744 | 749 | | |
745 | 750 | | |
746 | 751 | | |
| |||
750 | 755 | | |
751 | 756 | | |
752 | 757 | | |
| 758 | + | |
753 | 759 | | |
754 | 760 | | |
755 | 761 | | |
| |||
769 | 775 | | |
770 | 776 | | |
771 | 777 | | |
| 778 | + | |
772 | 779 | | |
773 | 780 | | |
774 | 781 | | |
| |||
778 | 785 | | |
779 | 786 | | |
780 | 787 | | |
| 788 | + | |
781 | 789 | | |
782 | 790 | | |
783 | 791 | | |
| |||
793 | 801 | | |
794 | 802 | | |
795 | 803 | | |
| 804 | + | |
796 | 805 | | |
797 | 806 | | |
798 | 807 | | |
| |||
802 | 811 | | |
803 | 812 | | |
804 | 813 | | |
| 814 | + | |
805 | 815 | | |
806 | 816 | | |
807 | 817 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
| |||
177 | 180 | | |
178 | 181 | | |
179 | 182 | | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
| |||
0 commit comments