Skip to content

Commit 9a09fce

Browse files
weiranclaude
andcommitted
Merge master into feature branch
Resolved conflict in CommentsComponents.swift by keeping the unvote swipe action logic and hidden row separators from the feature branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
2 parents bad6a2e + 82c8015 commit 9a09fce

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Features/Comments/Sources/Comments/CommentsComponents.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ struct CommentRow: View {
319319

320320
var body: some View {
321321
VStack(alignment: .leading, spacing: 8) {
322-
Divider().padding(.bottom, 6)
323322
HStack {
324323
Text(comment.by)
325324
.scaledFont(.subheadline)
@@ -354,11 +353,12 @@ struct CommentRow: View {
354353
.foregroundColor(.primary)
355354
}
356355
}
357-
.listRowInsets(.init(top: 12, leading: CGFloat((comment.level + 1) * 16), bottom: 8, trailing: 16))
356+
.listRowInsets([.top, .bottom, .trailing], 16)
357+
.listRowInsets([.leading], CGFloat((comment.level + 1) * 16))
358358
.contentShape(Rectangle())
359359
.onTapGesture { onToggle() }
360360
.accessibilityAddTraits(.isButton)
361-
.accessibilityHint(comment.visibility == .visible ? "Double-tap to collapse" : "Double-tap to expand")
361+
.accessibilityHint(comment.visibility == .visible ? "Tap to collapse" : "Tap to expand")
362362
.contextMenu {
363363
VotingContextMenuItems.commentVotingMenuItems(
364364
for: comment,

Features/Feed/Sources/Feed/FeedView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ public struct FeedView<NavigationStore: NavigationStoreProtocol>: View {
9292
searchText = newValue
9393
}
9494
}
95+
.onChange(of: selectedPostType) { _ in
96+
// Clear selection when category changes to prevent stale sidebar selection
97+
selectedPostId = nil
98+
}
9599
.task { @Sendable in
96100
// Set the navigation store for the voting view model
97101
votingViewModel.navigationStore = navigationStore
@@ -128,7 +132,7 @@ public struct FeedView<NavigationStore: NavigationStoreProtocol>: View {
128132
Group {
129133
if viewModel.hasActiveSearch {
130134
searchContentView
131-
} else if viewModel.isLoading, viewModel.posts.isEmpty {
135+
} else if viewModel.isLoading && viewModel.posts.isEmpty && viewModel.postType != .bookmarks {
132136
AppLoadingStateView(message: "Loading...")
133137
} else if shouldShowBookmarksEmptyState {
134138
AppEmptyStateView(
@@ -179,6 +183,7 @@ public struct FeedView<NavigationStore: NavigationStoreProtocol>: View {
179183
.if(isSidebar) { view in view.listStyle(.sidebar) }
180184
.if(!isSidebar) { view in view.listStyle(.plain) }
181185
.frame(maxWidth: .infinity, maxHeight: .infinity)
186+
.id(selectedPostType)
182187
}
183188

184189
@ViewBuilder

Features/Feed/Sources/Feed/FeedViewModel.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,15 @@ public final class FeedViewModel: @unchecked Sendable {
213213

214214
postType = newType
215215
persistLastFeedCategoryIfNeeded()
216-
await refreshFeed()
216+
reset(clearPosts: true) // Clear posts immediately to prevent flash of old data
217+
await feedLoader.refresh()
217218
}
218219

219220
@MainActor
220-
private func reset() {
221+
private func reset(clearPosts: Bool = false) {
222+
if clearPosts {
223+
feedLoader.data = []
224+
}
221225
postIds = Set()
222226
pageIndex = 1
223227
lastPostId = 0

0 commit comments

Comments
 (0)