chore(chat): diagnostic line for the first render of a big emoji
- Logs window active, play start age and loop length once per emoji, to find why an own sent emoji stays still on Windows - Temporary, removed with the fix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -15,7 +15,10 @@ const EMOTICON_GAP: f32 = 4.;
15
15
/// When each big emoji started its one play. Kept for the app's lifetime, so rows that
16
16
/// are laid out off screen or rebuilt keep their start and a reopened chat does not replay.
17
17
#[derive(Default)]
18
struct PlayedEmoticons(HashMap<ElementId, Instant>);
18
struct PlayedEmoticons(
19
HashMap<ElementId, Instant>,
20
std::collections::HashSet<ElementId>,
21
);
19
22
20
23
impl Global for PlayedEmoticons {}
21
24
@@ -60,9 +63,22 @@ impl RenderOnce for JumboEmoticon {
60
63
None => return div().size(px(EMOTICON_SIZE)).into_any_element(),
61
64
};
62
65
let now = Instant::now();
63
let started = play_start(&self.id, window.is_window_active(), now, cx);
66
let active = window.is_window_active();
67
let started = play_start(&self.id, active, now, cx);
64
68
let playing =
65
69
started.is_some_and(|started| now.duration_since(started) < resolved.loop_duration());
70
if cx
71
.default_global::<PlayedEmoticons>()
72
.1
73
.insert(self.id.clone())
74
{
75
log::info!(
76
"jumbo diag: first render {} active={active} age_ms={:?} loop_ms={} playing={playing}",
77
self.id,
78
started.map(|started| now.duration_since(started).as_millis()),
79
resolved.loop_duration().as_millis()
80
);
81
}
66
82
let image = if playing {
67
83
images.animated.clone()
68
84
} else {
@@ -15,7 +15,10 @@ const EMOTICON_GAP: f32 = 4.;15
/// When each big emoji started its one play. Kept for the app's lifetime, so rows that15
/// When each big emoji started its one play. Kept for the app's lifetime, so rows that16
/// are laid out off screen or rebuilt keep their start and a reopened chat does not replay.16
/// are laid out off screen or rebuilt keep their start and a reopened chat does not replay.17
#[derive(Default)]17
#[derive(Default)]18
struct PlayedEmoticons(HashMap<ElementId, Instant>);18
struct PlayedEmoticons(19
HashMap<ElementId, Instant>,20
std::collections::HashSet<ElementId>,21
);19
22
20
impl Global for PlayedEmoticons {}23
impl Global for PlayedEmoticons {}21
24
@@ -60,9 +63,22 @@ impl RenderOnce for JumboEmoticon {60
None => return div().size(px(EMOTICON_SIZE)).into_any_element(),63
None => return div().size(px(EMOTICON_SIZE)).into_any_element(),61
};64
};62
let now = Instant::now();65
let now = Instant::now();63
let started = play_start(&self.id, window.is_window_active(), now, cx);66
let active = window.is_window_active();67
let started = play_start(&self.id, active, now, cx);64
let playing =68
let playing =65
started.is_some_and(|started| now.duration_since(started) < resolved.loop_duration());69
started.is_some_and(|started| now.duration_since(started) < resolved.loop_duration());70
if cx71
.default_global::<PlayedEmoticons>()72
.173
.insert(self.id.clone())74
{75
log::info!(76
"jumbo diag: first render {} active={active} age_ms={:?} loop_ms={} playing={playing}",77
self.id,78
started.map(|started| now.duration_since(started).as_millis()),79
resolved.loop_duration().as_millis()80
);81
}66
let image = if playing {82
let image = if playing {67
images.animated.clone()83
images.animated.clone()68
} else {84
} else {