mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 12:38:24 +00:00
hotfix: Defer package synchronization in router to avoid state modification during build phase
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:zapstore/screens/search_screen.dart';
|
||||
import 'package:zapstore/screens/updates_screen.dart';
|
||||
import 'package:zapstore/screens/profile_screen.dart';
|
||||
import 'package:zapstore/services/package_manager/package_manager.dart';
|
||||
|
||||
/// Root paths for each navigation branch (used for back navigation handling)
|
||||
const kBranchRoots = ['/search', '/updates', '/profile'];
|
||||
|
||||
@@ -140,6 +141,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
||||
final wasUpdatesRoute = previousPath?.startsWith('/updates') ?? false;
|
||||
previousPath = currentPath;
|
||||
|
||||
Future.microtask(() {
|
||||
// Sync installed packages on every navigation to catch sideloads,
|
||||
// external installs/uninstalls, and self-updating apps.
|
||||
// This is a local-only platform channel call (~100-500ms, no network).
|
||||
@@ -152,6 +154,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
||||
if (wasUpdatesRoute && !isUpdatesRoute) {
|
||||
ref.read(packageManagerProvider.notifier).clearCompletedOperations();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
router.routerDelegate.addListener(onRouteChange);
|
||||
|
||||
Reference in New Issue
Block a user