Skip to content

Commit 3d7d779

Browse files
committed
Fix article list refresh synchronization
1 parent 9f57866 commit 3d7d779

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Planet/Entities/PlanetStore.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,12 @@ final class MyJSONDirectoryMonitor {
229229
return nil
230230
}
231231
}
232-
@Published var selectedArticleList: [ArticleModel]? = nil
232+
@Published private(set) var selectedArticleListVersion: UInt = 0
233+
@Published var selectedArticleList: [ArticleModel]? = nil {
234+
didSet {
235+
selectedArticleListVersion &+= 1
236+
}
237+
}
233238
@Published var selectedArticle: ArticleModel? {
234239
didSet {
235240
if selectedArticle != oldValue {

Planet/Views/Articles/ArticleListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ struct ArticleListView: View {
615615
.onAppear {
616616
viewModel.articles = filterArticles(planetStore.selectedArticleList ?? []) ?? []
617617
}
618-
.onChange(of: planetStore.selectedArticleList) { _ in
618+
.onChange(of: planetStore.selectedArticleListVersion) { _ in
619619
viewModel.articles = filterArticles(planetStore.selectedArticleList ?? []) ?? []
620620
}
621621
.onChange(of: viewModel.filter) { _ in

Planet/versioning.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CURRENT_PROJECT_VERSION = 2788
1+
CURRENT_PROJECT_VERSION = 2789

0 commit comments

Comments
 (0)