library: keep the cached bio on an empty refresh

This commit is contained in:
austinried
2026-10-19 13:14:08 +00:00
parent b379a22517
commit 98398ab2fe
2 changed files with 22 additions and 1 deletions
@@ -367,8 +367,11 @@ class LibraryRepository(
artistId: String,
): Result<Unit> =
try {
val biography = normalizeBiography(sourceRepository.artistBiography(sourceId, artistId))
val fetched = normalizeBiography(sourceRepository.artistBiography(sourceId, artistId))
val current = db.libraryDao().artistBioOnce(sourceId, artistId)
// An empty response can mean the metadata provider is temporarily down, so keep the
// cached biography instead of erasing it.
val biography = fetched ?: current?.biography
if (current == null || current.biography != biography) {
db.libraryDao().upsertArtistBio(ArtistBio(sourceId, artistId, biography))
}