diff --git a/MusicPimp/LibraryList.swift b/MusicPimp/LibraryList.swift index 7eeb0e9..2b54057 100644 --- a/MusicPimp/LibraryList.swift +++ b/MusicPimp/LibraryList.swift @@ -26,7 +26,10 @@ struct LibraryListInternal: View where T: LibraryVMLike, D: DownloaderLike .task { switch vm.appearAction { case .Reload: - await vm.load() + // Sometimes this .task is triggered twice, cancelling the previous one inadvertently, so as a workaround, load in a detached task + Task { + await vm.load() + } case .Dismiss: dismiss() case .Noop: diff --git a/MusicPimp/PimpViews.swift b/MusicPimp/PimpViews.swift index d56b9ee..8740074 100644 --- a/MusicPimp/PimpViews.swift +++ b/MusicPimp/PimpViews.swift @@ -67,6 +67,11 @@ func outcomeView(outcome: Outcome, @ViewBuilder render: (T) -> A) -> so case .Loaded(let t): render(t) case .Err(let error): - fullSizeText("Error. \(error)") + let message = switch error { + case let err as PimpError: err.message + case _ as URLError: "A network error occurred." + default: "An error occurred." + } + fullSizeText(message) } }