From 5165cf1d2f37c4eabe306337f0a8a251be5f88fa Mon Sep 17 00:00:00 2001 From: okxint <130782884+okxint@users.noreply.github.com> Date: Tue, 23 Jun 2026 23:13:56 +0530 Subject: [PATCH] fix(mobile): force AssetViewerPage recreation on repeated view intents (#29235) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(mobile): force AssetViewerPage recreation on repeated view intents When View in Immich is triggered a second time while the viewer is already open, auto_route's replaceAll reuses the existing route (same type, null key) and Flutter keeps the old ConsumerState alive. The PageController and preloader inside _AssetViewerState are late final, so they never reset — the viewer stays frozen on the previous asset. Passing UniqueKey() to AssetViewerRoute ensures each view intent creates a fresh widget element, so initState runs, the PageController is initialised from scratch, and the new TimelineService from the updated ProviderScope override is picked up correctly. Fixes #29230 * clean up --------- Co-authored-by: Alex Tran --- .../lib/providers/view_intent/view_intent_handler_android.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/lib/providers/view_intent/view_intent_handler_android.dart b/mobile/lib/providers/view_intent/view_intent_handler_android.dart index c00ff38648..51415af7b1 100644 --- a/mobile/lib/providers/view_intent/view_intent_handler_android.dart +++ b/mobile/lib/providers/view_intent/view_intent_handler_android.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/domain/models/asset/base_asset.model.dart'; import 'package:immich_mobile/domain/services/timeline.service.dart'; @@ -97,7 +98,7 @@ class AndroidViewIntentHandler implements ViewIntentHandler { await _router.replaceAll([ const TabShellRoute(), - AssetViewerRoute(initialIndex: 0, timelineService: timelineService), + AssetViewerRoute(key: UniqueKey(), initialIndex: 0, timelineService: timelineService), ]); } }