extension ApplicationMusicPlayer {
// This approach seems to work for all cases, but downstream consumers of
// the player need to hide the churn in ApplicationMusicPlayer properties
// from users of the player.
@MainActor
public func replaceQueueWithSingleSongQueueThenClear() async throws {
// replace the queue with itself
self.queue = ApplicationMusicPlayer.Queue(for: self.queue.entries.compactMap { $0.item }, startingAt: self.queue.currentEntry?.item)
// tell the queue to delete its hidden Station container
try await self.prepareToPlay()
// now the queue can be cleared without refilling
self.queue.entries = []
}
}