From de72a3842a1b33358d5349400c06740391645354 Mon Sep 17 00:00:00 2001 From: Cassio Rossi Date: Thu, 30 Jul 2026 01:02:12 +0100 Subject: [PATCH] fix(#321): mark push-notification deep-linked posts read once synced DeepLinkNewsDetailView resolved `post` once in .onAppear, so a push notification opening a brand-new article (not yet synced into FeedDB by the concurrent shouldReloadContent refresh) computed post == nil and silently skipped markAsRead(). Widget and Shortcut links only ever point to already-synced posts, so they were unaffected. Add .onChange(of: post) so the read state is applied reactively once the live @Query resolves a matching FeedDB row. Co-Authored-By: Claude --- .../MacMagazine/Features/News/DeepLinkNewsDetailView.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MacMagazine/MacMagazine/Features/News/DeepLinkNewsDetailView.swift b/MacMagazine/MacMagazine/Features/News/DeepLinkNewsDetailView.swift index c997dfba..58678614 100644 --- a/MacMagazine/MacMagazine/Features/News/DeepLinkNewsDetailView.swift +++ b/MacMagazine/MacMagazine/Features/News/DeepLinkNewsDetailView.swift @@ -47,6 +47,11 @@ struct DeepLinkNewsDetailView: View { post?.markAsRead() try? modelContext.save() } + .onChange(of: post) { _, newValue in + guard let newValue, !newValue.read else { return } + newValue.markAsRead() + try? modelContext.save() + } } }