mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Fix crashing bug on iPad and macOS when removing blank posts
This commit is contained in:
parent
bc4c43f40c
commit
776f1ed3ed
@ -35,7 +35,9 @@ struct PostEditorStatusToolbarView: View {
|
||||
.foregroundColor(.secondary)
|
||||
Button(action: {
|
||||
model.selectedPost = nil
|
||||
model.posts.remove(post)
|
||||
DispatchQueue.main.async {
|
||||
model.posts.remove(post)
|
||||
}
|
||||
}, label: {
|
||||
Image(systemName: "trash")
|
||||
})
|
||||
|
@ -30,8 +30,9 @@ struct PostEditorView: View {
|
||||
.foregroundColor(.secondary)
|
||||
Button(action: {
|
||||
self.presentationMode.wrappedValue.dismiss()
|
||||
model.selectedPost = nil
|
||||
model.posts.remove(post)
|
||||
DispatchQueue.main.async {
|
||||
model.posts.remove(post)
|
||||
}
|
||||
}, label: {
|
||||
Image(systemName: "trash")
|
||||
})
|
||||
@ -163,7 +164,7 @@ struct PostEditorView: View {
|
||||
&& post.status == PostStatus.local.rawValue
|
||||
&& post.updatedDate == nil
|
||||
&& post.postId == nil {
|
||||
withAnimation {
|
||||
DispatchQueue.main.async {
|
||||
model.posts.remove(post)
|
||||
model.posts.loadCachedPosts()
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ struct PostEditorView: View {
|
||||
&& post.status == PostStatus.local.rawValue
|
||||
&& post.updatedDate == nil
|
||||
&& post.postId == nil {
|
||||
withAnimation {
|
||||
DispatchQueue.main.async {
|
||||
model.posts.remove(post)
|
||||
model.posts.loadCachedPosts()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user