Fix placeholder cells

This commit is contained in:
Arkadiusz Fal 2022-12-11 17:19:21 +01:00
parent 899e66b204
commit 33bd052fdc
2 changed files with 5 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import SDWebImageSwiftUI
import SwiftUI import SwiftUI
struct VideoCell: View { struct VideoCell: View {
var id: String?
private var video: Video private var video: Video
@Environment(\.horizontalCells) private var horizontalCells @Environment(\.horizontalCells) private var horizontalCells
@ -30,7 +31,8 @@ struct VideoCell: View {
@FetchRequest private var watchRequest: FetchedResults<Watch> @FetchRequest private var watchRequest: FetchedResults<Watch>
init(video: Video) { init(id: String? = nil, video: Video) {
self.id = id
self.video = video self.video = video
_watchRequest = video.watchFetchRequest _watchRequest = video.watchFetchRequest
} }
@ -52,7 +54,7 @@ struct VideoCell: View {
.contextMenu { .contextMenu {
VideoContextMenuView(video: video) VideoContextMenuView(video: video)
} }
.id(video.videoID) .id(id ?? video.videoID)
} }
private var thumbnailRoundingCornerRadius: Double { private var thumbnailRoundingCornerRadius: Double {

View File

@ -3,7 +3,7 @@ import SwiftUI
struct PlaceholderCell: View { struct PlaceholderCell: View {
var body: some View { var body: some View {
VideoCell(video: .fixture) VideoCell(id: UUID().uuidString, video: .fixture)
.redacted(reason: .placeholder) .redacted(reason: .placeholder)
} }
} }