Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions V2er/View/Widget/Updatable/HeadIndicatorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ struct HeadIndicatorView: View {
.foregroundColor(.secondaryText)
}
}
.onAppear {
// Initialize animatedOnlineCount when view appears with valid stats
if animatedOnlineCount == 0 && stats.onlineCount > 0 {
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition animatedOnlineCount == 0 could prevent legitimate updates if the actual online count is 0. If the view appears when stats.onlineCount is 0 and later increases, the initialization won't trigger on subsequent appearances. Consider using a more explicit flag to track initialization state, or simplify the condition to just check if stats.onlineCount > 0.

Suggested change
if animatedOnlineCount == 0 && stats.onlineCount > 0 {
if animatedOnlineCount != stats.onlineCount {

Copilot uses AI. Check for mistakes.
animatedOnlineCount = stats.onlineCount
}
}
.onChange(of: stats.onlineCount) { newValue in
withAnimation(.easeInOut(duration: 0.3)) {
animatedOnlineCount = newValue
Expand Down
Loading