fix: mark as read when entry scrolls OFF screen, not on appear
Uses .onDisappear instead of .onAppear — entries are marked as read only when they scroll past the top of the viewport, not when the list first renders. Same behavior as proper RSS readers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,12 @@ struct EntryListView: View {
|
|||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
|
.onDisappear {
|
||||||
|
// Mark as read when card scrolls off the top
|
||||||
|
if !entry.isRead {
|
||||||
|
Task { await vm.markAsRead(entry) }
|
||||||
|
}
|
||||||
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
entryContextMenu(entry: entry, vm: vm)
|
entryContextMenu(entry: entry, vm: vm)
|
||||||
}
|
}
|
||||||
@@ -65,7 +71,7 @@ struct EntryListView: View {
|
|||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.onAppear {
|
.onDisappear {
|
||||||
if !entry.isRead {
|
if !entry.isRead {
|
||||||
Task { await vm.markAsRead(entry) }
|
Task { await vm.markAsRead(entry) }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user