mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
fix(mobile): Prevents duplicate taps navigating to the same route twice (#1855)
This commit is contained in:
parent
9323cc76d9
commit
4ed96cf1bd
4 changed files with 553 additions and 224 deletions
17
mobile/lib/routing/duplicate_guard.dart
Normal file
17
mobile/lib/routing/duplicate_guard.dart
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// Guards against duplicate navigation to this route
|
||||
class DuplicateGuard extends AutoRouteGuard {
|
||||
DuplicateGuard();
|
||||
@override
|
||||
void onNavigation(NavigationResolver resolver, StackRouter router) async {
|
||||
// Duplicate navigation
|
||||
if (resolver.route.name == router.current.name) {
|
||||
debugPrint('DuplicateGuard: Preventing duplicate route navigation for ${resolver.route.name}');
|
||||
resolver.next(false);
|
||||
} else {
|
||||
resolver.next(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue