fix(chat): drop the trailing skeleton bubble while a chat syncs
A sync slower than 1s added a placeholder bubble at the bottom even when no new message arrived. Like Teams web, a cached chat now shows only the header progress line; skeletons stay for an empty cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -68,7 +68,7 @@ It signs you in through a real Teams web page and lets that page make the API ca
68
68
69
69
| Step | What happens |
70
70
|---|---|
71
| Start | The UI renders from the SQLite cache right away. A chat still syncing shows a progress line in its header and skeleton bubbles |
71
| Start | The UI renders from the SQLite cache right away. A chat still syncing shows a progress line in its header. Skeleton bubbles only when the cache has no messages yet |
72
72
| Sync | `core` fetches chats and channels from Graph with delta queries, pins and folders from the chat service |
73
73
| Live | `chatsvc` keeps the Trouter WebSocket open. An event only says "something changed", the content is then fetched fresh |
74
74
| Write | Sends, edits and reactions go out through Graph or the chat service, then the cache updates |
@@ -68,7 +68,7 @@ It signs you in through a real Teams web page and lets that page make the API ca68
68
69
| Step | What happens |69
| Step | What happens |70
|---|---|70
|---|---|71
| Start | The UI renders from the SQLite cache right away. A chat still syncing shows a progress line in its header and skeleton bubbles |71
| Start | The UI renders from the SQLite cache right away. A chat still syncing shows a progress line in its header. Skeleton bubbles only when the cache has no messages yet |72
| Sync | `core` fetches chats and channels from Graph with delta queries, pins and folders from the chat service |72
| Sync | `core` fetches chats and channels from Graph with delta queries, pins and folders from the chat service |73
| Live | `chatsvc` keeps the Trouter WebSocket open. An event only says "something changed", the content is then fetched fresh |73
| Live | `chatsvc` keeps the Trouter WebSocket open. An event only says "something changed", the content is then fetched fresh |74
| Write | Sends, edits and reactions go out through Graph or the chat service, then the cache updates |74
| Write | Sends, edits and reactions go out through Graph or the chat service, then the cache updates |@@ -174,13 +174,6 @@ pub struct Skeleton {
174
174
pub lines: u8,
175
175
}
176
176
177
const SKELETON_TRAILING: Skeleton = Skeleton {
178
key: "skeleton-trailing",
179
own: false,
180
width_ratio: 0.32,
181
lines: 1,
182
};
183
184
177
const SKELETON_PLACEHOLDERS: [Skeleton; 4] = [
185
178
Skeleton {
186
179
key: "skeleton-0",
@@ -215,10 +208,6 @@ pub fn placeholder_rows() -> Vec<Row> {
215
208
.collect()
216
209
}
217
210
218
pub fn trailing_skeleton() -> Row {
219
Row::Skeleton(SKELETON_TRAILING)
220
}
221
222
211
fn sender_key(row: &MessageRow) -> &str {
223
212
row.sender_id.as_deref().unwrap_or(&row.author)
224
213
}
@@ -174,13 +174,6 @@ pub struct Skeleton {174
pub lines: u8,174
pub lines: u8,175
}175
}176
176
177
const SKELETON_TRAILING: Skeleton = Skeleton {178
key: "skeleton-trailing",179
own: false,180
width_ratio: 0.32,181
lines: 1,182
};183
184
const SKELETON_PLACEHOLDERS: [Skeleton; 4] = [177
const SKELETON_PLACEHOLDERS: [Skeleton; 4] = [185
Skeleton {178
Skeleton {186
key: "skeleton-0",179
key: "skeleton-0",@@ -215,10 +208,6 @@ pub fn placeholder_rows() -> Vec<Row> {215
.collect()208
.collect()216
}209
}217
210
218
pub fn trailing_skeleton() -> Row {219
Row::Skeleton(SKELETON_TRAILING)220
}221
222
fn sender_key(row: &MessageRow) -> &str {211
fn sender_key(row: &MessageRow) -> &str {223
row.sender_id.as_deref().unwrap_or(&row.author)212
row.sender_id.as_deref().unwrap_or(&row.author)224
}213
}@@ -46,7 +46,7 @@ use crate::rows::{
46
46
Delivery, MessageRow, PendingReactions, Receipt, Row, RowContext, StartInfo, api_reaction,
47
47
apply_pending_reactions, assign_series, changed_indices, diff_keys, flat_rows,
48
48
has_own_reaction, message_draft, message_text, placeholder_rows, reaction_glyph, reply_excerpt,
49
set_own_reaction, thread_list_rows, thread_rows, trailing_skeleton,
49
set_own_reaction, thread_list_rows, thread_rows,
50
50
};
51
51
use crate::runtime;
52
52
use crate::sidebar_model::{AvatarSpec, Face};
@@ -64,7 +64,6 @@ const JUMP_SCAN_LIMIT: usize = 5000;
64
64
const JUMP_CONTEXT_MESSAGES: usize = 12;
65
65
const HIGHLIGHT_DURATION: Duration = Duration::from_secs(2);
66
66
const PROGRESS_DELAY: Duration = Duration::from_millis(400);
67
const SKELETON_DELAY: Duration = Duration::from_millis(1000);
68
67
const SLOW_AFTER: Duration = Duration::from_secs(8);
69
68
const PROGRESS_MIN_VISIBLE: Duration = Duration::from_millis(500);
70
69
const PROGRESS_BAR_PERIOD: Duration = Duration::from_millis(1400);
@@ -96,7 +95,6 @@ struct SyncProgress {
96
95
empty_cache: bool,
97
96
newest_cached: Option<DateTime<Utc>>,
98
97
shown_at: Option<Instant>,
99
trailing_skeleton: bool,
100
98
slow: bool,
101
99
failed: bool,
102
100
}
@@ -1174,7 +1172,6 @@ impl ConversationView {
1174
1172
let placeholders = current.sync.messages
1175
1173
&& records.is_empty()
1176
1174
&& !matches!(current.mode, ViewMode::Thread(_));
1177
let trailing = current.sync.trailing_skeleton && current.mode == ViewMode::Flat;
1178
1175
let mut rows = match ¤t.mode {
1179
1176
_ if placeholders => {
1180
1177
current.has_older = false;
@@ -1197,9 +1194,6 @@ impl ConversationView {
1197
1194
thread_rows(&records, root_id, &context)
1198
1195
}
1199
1196
};
1200
if trailing && !placeholders {
1201
rows.push(trailing_skeleton());
1202
}
1203
1197
rows.extend(
1204
1198
self.pending
1205
1199
.iter()
@@ -1352,8 +1346,7 @@ impl ConversationView {
1352
1346
cx.spawn(async move |this, cx| {
1353
1347
let stages = [
1354
1348
(PROGRESS_DELAY, Duration::ZERO),
1355
(SKELETON_DELAY, PROGRESS_DELAY),
1356
(SLOW_AFTER, SKELETON_DELAY),
1349
(SLOW_AFTER, PROGRESS_DELAY),
1357
1350
];
1358
1351
for (stage, (at, previous)) in stages.into_iter().enumerate() {
1359
1352
cx.background_executor().timer(at - previous).await;
@@ -1377,11 +1370,6 @@ impl ConversationView {
1377
1370
}
1378
1371
match stage {
1379
1372
0 => sync.shown_at = Some(Instant::now()),
1380
1 if sync.messages => {
1381
sync.trailing_skeleton = true;
1382
self.rebuild(false, cx);
1383
}
1384
1 => {}
1385
1373
_ => sync.slow = true,
1386
1374
}
1387
1375
cx.notify();
@@ -1401,7 +1389,6 @@ impl ConversationView {
1401
1389
return;
1402
1390
};
1403
1391
sync.messages = false;
1404
sync.trailing_skeleton = false;
1405
1392
let newest_cached = sync.newest_cached;
1406
1393
match result {
1407
1394
Ok(Ok(_)) => self.mark_fetched_new(newest_cached, cx),
@@ -46,7 +46,7 @@ use crate::rows::{46
Delivery, MessageRow, PendingReactions, Receipt, Row, RowContext, StartInfo, api_reaction,46
Delivery, MessageRow, PendingReactions, Receipt, Row, RowContext, StartInfo, api_reaction,47
apply_pending_reactions, assign_series, changed_indices, diff_keys, flat_rows,47
apply_pending_reactions, assign_series, changed_indices, diff_keys, flat_rows,48
has_own_reaction, message_draft, message_text, placeholder_rows, reaction_glyph, reply_excerpt,48
has_own_reaction, message_draft, message_text, placeholder_rows, reaction_glyph, reply_excerpt,49
set_own_reaction, thread_list_rows, thread_rows, trailing_skeleton,49
set_own_reaction, thread_list_rows, thread_rows,50
};50
};51
use crate::runtime;51
use crate::runtime;52
use crate::sidebar_model::{AvatarSpec, Face};52
use crate::sidebar_model::{AvatarSpec, Face};@@ -64,7 +64,6 @@ const JUMP_SCAN_LIMIT: usize = 5000;64
const JUMP_CONTEXT_MESSAGES: usize = 12;64
const JUMP_CONTEXT_MESSAGES: usize = 12;65
const HIGHLIGHT_DURATION: Duration = Duration::from_secs(2);65
const HIGHLIGHT_DURATION: Duration = Duration::from_secs(2);66
const PROGRESS_DELAY: Duration = Duration::from_millis(400);66
const PROGRESS_DELAY: Duration = Duration::from_millis(400);67
const SKELETON_DELAY: Duration = Duration::from_millis(1000);68
const SLOW_AFTER: Duration = Duration::from_secs(8);67
const SLOW_AFTER: Duration = Duration::from_secs(8);69
const PROGRESS_MIN_VISIBLE: Duration = Duration::from_millis(500);68
const PROGRESS_MIN_VISIBLE: Duration = Duration::from_millis(500);70
const PROGRESS_BAR_PERIOD: Duration = Duration::from_millis(1400);69
const PROGRESS_BAR_PERIOD: Duration = Duration::from_millis(1400);@@ -96,7 +95,6 @@ struct SyncProgress {96
empty_cache: bool,95
empty_cache: bool,97
newest_cached: Option<DateTime<Utc>>,96
newest_cached: Option<DateTime<Utc>>,98
shown_at: Option<Instant>,97
shown_at: Option<Instant>,99
trailing_skeleton: bool,100
slow: bool,98
slow: bool,101
failed: bool,99
failed: bool,102
}100
}@@ -1174,7 +1172,6 @@ impl ConversationView {1174
let placeholders = current.sync.messages1172
let placeholders = current.sync.messages1175
&& records.is_empty()1173
&& records.is_empty()1176
&& !matches!(current.mode, ViewMode::Thread(_));1174
&& !matches!(current.mode, ViewMode::Thread(_));1177
let trailing = current.sync.trailing_skeleton && current.mode == ViewMode::Flat;1178
let mut rows = match ¤t.mode {1175
let mut rows = match ¤t.mode {1179
_ if placeholders => {1176
_ if placeholders => {1180
current.has_older = false;1177
current.has_older = false;@@ -1197,9 +1194,6 @@ impl ConversationView {1197
thread_rows(&records, root_id, &context)1194
thread_rows(&records, root_id, &context)1198
}1195
}1199
};1196
};1200
if trailing && !placeholders {1201
rows.push(trailing_skeleton());1202
}1203
rows.extend(1197
rows.extend(1204
self.pending1198
self.pending1205
.iter()1199
.iter()@@ -1352,8 +1346,7 @@ impl ConversationView {1352
cx.spawn(async move |this, cx| {1346
cx.spawn(async move |this, cx| {1353
let stages = [1347
let stages = [1354
(PROGRESS_DELAY, Duration::ZERO),1348
(PROGRESS_DELAY, Duration::ZERO),1355
(SKELETON_DELAY, PROGRESS_DELAY),1349
(SLOW_AFTER, PROGRESS_DELAY),1356
(SLOW_AFTER, SKELETON_DELAY),1357
];1350
];1358
for (stage, (at, previous)) in stages.into_iter().enumerate() {1351
for (stage, (at, previous)) in stages.into_iter().enumerate() {1359
cx.background_executor().timer(at - previous).await;1352
cx.background_executor().timer(at - previous).await;@@ -1377,11 +1370,6 @@ impl ConversationView {1377
}1370
}1378
match stage {1371
match stage {1379
0 => sync.shown_at = Some(Instant::now()),1372
0 => sync.shown_at = Some(Instant::now()),1380
1 if sync.messages => {1381
sync.trailing_skeleton = true;1382
self.rebuild(false, cx);1383
}1384
1 => {}1385
_ => sync.slow = true,1373
_ => sync.slow = true,1386
}1374
}1387
cx.notify();1375
cx.notify();@@ -1401,7 +1389,6 @@ impl ConversationView {1401
return;1389
return;1402
};1390
};1403
sync.messages = false;1391
sync.messages = false;1404
sync.trailing_skeleton = false;1405
let newest_cached = sync.newest_cached;1392
let newest_cached = sync.newest_cached;1406
match result {1393
match result {1407
Ok(Ok(_)) => self.mark_fetched_new(newest_cached, cx),1394
Ok(Ok(_)) => self.mark_fetched_new(newest_cached, cx),