diff --git a/lib/screens/collections_screen.dart b/lib/screens/collections_screen.dart index 1e1c8c5..f25b25c 100644 --- a/lib/screens/collections_screen.dart +++ b/lib/screens/collections_screen.dart @@ -44,7 +44,7 @@ class CollectionsScreenState extends State void _handleSyncChanged() { if (!mounted) return; - _load(); + _load(showLoading: false); } @override @@ -59,7 +59,7 @@ class CollectionsScreenState extends State void refreshIfStale({Duration maxAge = const Duration(seconds: 10)}) { if (DateTime.now().difference(_lastLoadedAt) > maxAge) { - _load(); + _load(showLoading: false); } } @@ -233,7 +233,7 @@ class CollectionsScreenState extends State userRole: c.role, ), ), - ).then((_) => _load()); // refresh counts when coming back + ).then((_) => _load(showLoading: false)); // refresh counts when coming back } void _manageCollection(Collection c) { @@ -241,10 +241,14 @@ class CollectionsScreenState extends State MaterialPageRoute( builder: (_) => ManageCollectionScreen(collection: c), ), - ).then((_) => _load()); + ).then((_) => _load(showLoading: false)); } Future _setActiveCollection(String collectionId) async { + if (collectionId == _activeCollectionId) { + return; + } + final userId = supabase.auth.currentUser?.id; if (userId == null) { showGlobalSnackBar('Please sign in again.', isError: true); @@ -257,9 +261,14 @@ class CollectionsScreenState extends State userId: userId, collectionId: collectionId, ); + + final shouldNotifySync = collectionId != _activeCollectionId; + if (!mounted) return; setState(() => _activeCollectionId = collectionId); - MainCollectionSync.notifyChanged(); + if (shouldNotifySync) { + MainCollectionSync.notifyChanged(); + } showGlobalInfo('Main collection set for scanning.'); } diff --git a/pubspec.yaml b/pubspec.yaml index 5352a8b..043ed93 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 # 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. -version: 3.0.0+1 +version: 3.1.1+1 environment: sdk: ^3.11.0