1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 15:47:54 +02:00

fix: timeline service uninitialised across routes (#19544)

This commit is contained in:
shenlong
2025-07-01 20:53:20 +05:30
committed by GitHub
parent f59b0bab5a
commit 15be3437bf
9 changed files with 95 additions and 139 deletions

View File

@ -1,10 +1,7 @@
import 'dart:async';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
@RoutePage()
class MainTimelinePage extends ConsumerWidget {
@ -12,23 +9,6 @@ class MainTimelinePage extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return ProviderScope(
key: ref.watch(timelineUsersProvider).value != null
? ValueKey(ref.watch(timelineUsersProvider).value)
: const ValueKey("main-timeline"),
overrides: [
timelineServiceProvider.overrideWith(
(ref) {
final timelineUsers =
ref.watch(timelineUsersProvider).valueOrNull ?? [];
final timelineService =
ref.watch(timelineFactoryProvider).main(timelineUsers);
ref.onDispose(() => unawaited(timelineService.dispose()));
return timelineService;
},
),
],
child: const Timeline(),
);
return const Timeline();
}
}