Merge feat/collections-refresh-v3.1.1

This commit is contained in:
Lukas Müllner 2026-03-10 07:09:10 +01:00
commit 6326ca2d0c
2 changed files with 15 additions and 6 deletions

View file

@ -44,7 +44,7 @@ class CollectionsScreenState extends State<CollectionsScreen>
void _handleSyncChanged() { void _handleSyncChanged() {
if (!mounted) return; if (!mounted) return;
_load(); _load(showLoading: false);
} }
@override @override
@ -59,7 +59,7 @@ class CollectionsScreenState extends State<CollectionsScreen>
void refreshIfStale({Duration maxAge = const Duration(seconds: 10)}) { void refreshIfStale({Duration maxAge = const Duration(seconds: 10)}) {
if (DateTime.now().difference(_lastLoadedAt) > maxAge) { if (DateTime.now().difference(_lastLoadedAt) > maxAge) {
_load(); _load(showLoading: false);
} }
} }
@ -233,7 +233,7 @@ class CollectionsScreenState extends State<CollectionsScreen>
userRole: c.role, userRole: c.role,
), ),
), ),
).then((_) => _load()); // refresh counts when coming back ).then((_) => _load(showLoading: false)); // refresh counts when coming back
} }
void _manageCollection(Collection c) { void _manageCollection(Collection c) {
@ -241,10 +241,14 @@ class CollectionsScreenState extends State<CollectionsScreen>
MaterialPageRoute( MaterialPageRoute(
builder: (_) => ManageCollectionScreen(collection: c), builder: (_) => ManageCollectionScreen(collection: c),
), ),
).then((_) => _load()); ).then((_) => _load(showLoading: false));
} }
Future<void> _setActiveCollection(String collectionId) async { Future<void> _setActiveCollection(String collectionId) async {
if (collectionId == _activeCollectionId) {
return;
}
final userId = supabase.auth.currentUser?.id; final userId = supabase.auth.currentUser?.id;
if (userId == null) { if (userId == null) {
showGlobalSnackBar('Please sign in again.', isError: true); showGlobalSnackBar('Please sign in again.', isError: true);
@ -257,9 +261,14 @@ class CollectionsScreenState extends State<CollectionsScreen>
userId: userId, userId: userId,
collectionId: collectionId, collectionId: collectionId,
); );
final shouldNotifySync = collectionId != _activeCollectionId;
if (!mounted) return; if (!mounted) return;
setState(() => _activeCollectionId = collectionId); setState(() => _activeCollectionId = collectionId);
MainCollectionSync.notifyChanged(); if (shouldNotifySync) {
MainCollectionSync.notifyChanged();
}
showGlobalInfo('Main collection set for scanning.'); showGlobalInfo('Main collection set for scanning.');
} }

View file

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 3.0.0+1 version: 3.1.1+1
environment: environment:
sdk: ^3.11.0 sdk: ^3.11.0