Correctly refresh artist and album views when filters change

This commit is contained in:
emeric
2023-07-22 12:01:48 +02:00
parent e9087d108b
commit e92d8a1367
4 changed files with 8 additions and 2 deletions
+3 -1
View File
@@ -76,6 +76,7 @@ Artist::Artist(Filters& filters, PlayQueueController& controller)
filters.updated().connect([this]
{
_needForceRefresh = true;
refreshView();
});
@@ -111,12 +112,13 @@ Artist::refreshView()
const auto artistId {extractArtistIdFromInternalPath()};
// consider everything is up to date is the same artist is being rendered
if (artistId && *artistId == _artistId)
if (!_needForceRefresh && artistId && *artistId == _artistId)
return;
clear();
_artistId = {};
_trackContainer = nullptr;
_needForceRefresh = false;
if (!artistId)
throw ArtistNotFoundException {};
+1
View File
@@ -80,6 +80,7 @@ namespace UserInterface
ReleaseContainer _appearsOnReleaseContainer {};
InfiniteScrollingContainer* _trackContainer {};
Database::ArtistId _artistId {};
bool _needForceRefresh {};
};
} // namespace UserInterface
+3 -1
View File
@@ -184,6 +184,7 @@ Release::Release(Filters& filters, PlayQueueController& playQueueController)
_filters.updated().connect([this]
{
_needForceRefresh = true;
refreshView();
});
@@ -220,11 +221,12 @@ Release::refreshView()
const auto releaseId {extractReleaseIdFromInternalPath()};
// consider everything is up to date is the same release is being rendered
if (releaseId && *releaseId == _releaseId)
if (!_needForceRefresh && releaseId && *releaseId == _releaseId)
return;
clear();
_releaseId = {};
_needForceRefresh = false;
if (!releaseId)
throw ReleaseNotFoundException {};
+1
View File
@@ -48,6 +48,7 @@ namespace UserInterface
Filters& _filters;
PlayQueueController& _playQueueController;
Database::ReleaseId _releaseId;
bool _needForceRefresh {};
};
} // namespace UserInterface