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] filters.updated().connect([this]
{ {
_needForceRefresh = true;
refreshView(); refreshView();
}); });
@@ -111,12 +112,13 @@ Artist::refreshView()
const auto artistId {extractArtistIdFromInternalPath()}; const auto artistId {extractArtistIdFromInternalPath()};
// consider everything is up to date is the same artist is being rendered // consider everything is up to date is the same artist is being rendered
if (artistId && *artistId == _artistId) if (!_needForceRefresh && artistId && *artistId == _artistId)
return; return;
clear(); clear();
_artistId = {}; _artistId = {};
_trackContainer = nullptr; _trackContainer = nullptr;
_needForceRefresh = false;
if (!artistId) if (!artistId)
throw ArtistNotFoundException {}; throw ArtistNotFoundException {};
+1
View File
@@ -80,6 +80,7 @@ namespace UserInterface
ReleaseContainer _appearsOnReleaseContainer {}; ReleaseContainer _appearsOnReleaseContainer {};
InfiniteScrollingContainer* _trackContainer {}; InfiniteScrollingContainer* _trackContainer {};
Database::ArtistId _artistId {}; Database::ArtistId _artistId {};
bool _needForceRefresh {};
}; };
} // namespace UserInterface } // namespace UserInterface
+3 -1
View File
@@ -184,6 +184,7 @@ Release::Release(Filters& filters, PlayQueueController& playQueueController)
_filters.updated().connect([this] _filters.updated().connect([this]
{ {
_needForceRefresh = true;
refreshView(); refreshView();
}); });
@@ -220,11 +221,12 @@ Release::refreshView()
const auto releaseId {extractReleaseIdFromInternalPath()}; const auto releaseId {extractReleaseIdFromInternalPath()};
// consider everything is up to date is the same release is being rendered // consider everything is up to date is the same release is being rendered
if (releaseId && *releaseId == _releaseId) if (!_needForceRefresh && releaseId && *releaseId == _releaseId)
return; return;
clear(); clear();
_releaseId = {}; _releaseId = {};
_needForceRefresh = false;
if (!releaseId) if (!releaseId)
throw ReleaseNotFoundException {}; throw ReleaseNotFoundException {};
+1
View File
@@ -48,6 +48,7 @@ namespace UserInterface
Filters& _filters; Filters& _filters;
PlayQueueController& _playQueueController; PlayQueueController& _playQueueController;
Database::ReleaseId _releaseId; Database::ReleaseId _releaseId;
bool _needForceRefresh {};
}; };
} // namespace UserInterface } // namespace UserInterface