Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions V2er/View/Feed/FeedPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ struct FeedPage: BaseHomePageView {
log("FeedPage.onAppear")
if !state.hasLoadedOnce {
dispatch(FeedActions.FetchData.Start(autoLoad: true))
if AccountState.hasSignIn() {
Task { await run(action: FeedActions.FetchOnlineStats.Start()) }
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions V2er/View/Widget/Updatable/UpdatableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ struct UpdatableView<Content: View>: View {

Task {
await onRefresh?()
// Decide delay (ms): 1200 if we had/now have online stats so users can notice updates; otherwise 0.
// Minimum 800ms delay for refresh animation, 1000ms if online stats exist
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The comment should explain why these specific delay values were chosen (e.g., 'to ensure users see the refresh animation feedback' or 'to allow users to notice online stats updates'), not just state what the values are.

Suggested change
// Minimum 800ms delay for refresh animation, 1000ms if online stats exist
// Use a minimum 800ms delay to ensure users see the refresh animation feedback.
// If online stats are present before or after refresh, use 1000ms to give users time to notice updated online stats.

Copilot uses AI. Check for mistakes.
let hasOnlineStatsNow = onlineStats != nil
let delayMs = (hadOnlineStatsBefore || hasOnlineStatsNow) ? 1000 : 0
let delayMs = (hadOnlineStatsBefore || hasOnlineStatsNow) ? 1000 : 800
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The delay values 1000 and 800 are magic numbers. Consider extracting them as named constants at the struct level (e.g., private let refreshDelayWithStats = 1000, private let minimumRefreshDelay = 800) to improve code maintainability and make the intent clearer.

Copilot uses AI. Check for mistakes.
runInMain(delay: delayMs) {
withAnimation {
isRefreshing = false
Expand Down
Loading