feat(app): offline-кэш на остальных экранах — фаза 5
accounts, cashflow, categories, goals, income, portfolio (+instrument), rebalance, tax, rules переведены на Cached<T> по контракту docs/ai/offline-cache.md. Общие/второстепенные селекторы (scopesProvider, categoriesListProvider и т.п.) оставлены как есть — не основной контент экрана. sync_page.dart и settings_page.dart не тронуты (первый — заменён health-page отдельно, второй — чистые действия без списка для баннера).
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/api/api_client.dart';
|
||||
import '../../core/cache/cached.dart';
|
||||
import 'data/goals_api.dart';
|
||||
|
||||
final goalsApiProvider = Provider<GoalsApi>((ref) => GoalsApi(ref.watch(apiProvider).dio));
|
||||
|
||||
/// See `docs/ai/offline-cache.md`.
|
||||
final goalsProvider =
|
||||
FutureProvider.autoDispose<List<Goal>>((ref) => ref.watch(goalsApiProvider).list());
|
||||
FutureProvider.autoDispose<Cached<List<Goal>>>((ref) => ref.watch(goalsApiProvider).list());
|
||||
|
||||
/// Progress is computed server-side and refetched per goal — the client never projects
|
||||
/// anything itself.
|
||||
final goalProgressProvider =
|
||||
FutureProvider.autoDispose.family<GoalProgress, int>((ref, id) async {
|
||||
FutureProvider.autoDispose.family<Cached<GoalProgress>, int>((ref, id) async {
|
||||
return ref.watch(goalsApiProvider).progress(id);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user