mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 13:19:44 +02:00
perf(search): release derived caches when track results change
Clear cached buckets, sorted results and history lookups when the source track list changes. This releases the previous search even when empty, loading or error branches skip building results.
This commit is contained in:
1 parent
d91bfae155
commit
043c7bd874
1 file changed
+8
@@ -361,6 +361,14 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
}
|
||||
|
||||
void _onTrackStateChanged(TrackState? previous, TrackState next) {
|
||||
if (!identical(previous?.tracks, next.tracks)) {
|
||||
// Home stays alive across tabs. Empty/loading/error branches can skip
|
||||
// result building, so release the previous search's derived lists here.
|
||||
_searchBucketsSourceTracks = null;
|
||||
_searchBucketsCache = null;
|
||||
_invalidateSearchSortCaches();
|
||||
_historySnapshot.update(const []);
|
||||
}
|
||||
if (previous != null &&
|
||||
!next.hasContent &&
|
||||
!next.hasSearchText &&
|
||||
|
||||
Reference in new issue
Block a user