diff --git a/Yattee/Views/Playlist/UnifiedPlaylistDetailView.swift b/Yattee/Views/Playlist/UnifiedPlaylistDetailView.swift index 1948b4cc..a5f37450 100644 --- a/Yattee/Views/Playlist/UnifiedPlaylistDetailView.swift +++ b/Yattee/Views/Playlist/UnifiedPlaylistDetailView.swift @@ -282,6 +282,11 @@ struct UnifiedPlaylistDetailView: View { ) { Button(String(localized: "common.delete"), role: .destructive) { if let localPlaylist { + // Let go of the model *before* deleting it: dismissal is + // animated, so this view renders at least once more, and + // reading a deleted model — the duration in the subtitle is + // enough — traps in SwiftData with "context is missing". + self.localPlaylist = nil dataManager?.deletePlaylist(localPlaylist) dismiss() } else {