2.9 KiB
2.9 KiB
Frontend Cache + SWR + Boot Prewarm Implementation Plan (Updated)
This document replaces the previous version and removes outdated path references.
Current Architecture Baseline
- Shared infrastructure is under
apps/lib/data/only:- cache:
apps/lib/data/cache/ - network:
apps/lib/data/network/ - storage:
apps/lib/data/storage/
- cache:
- Feature business repositories/models live under each feature:
- calendar:
apps/lib/features/calendar/data/repositories/,apps/lib/features/calendar/data/models/ - messages:
apps/lib/features/messages/data/repositories/,apps/lib/features/messages/data/models/ - contacts:
apps/lib/features/contacts/data/repositories/,apps/lib/features/contacts/data/models/ - chat history cache repo:
apps/lib/features/chat/data/repositories/chat_history_repository.dart
- calendar:
Scope
- Keep cache infra generic and reusable.
- Keep TTL policy defined per feature repository (not centralized in shared cache).
- Keep boot prewarm bounded by timeout with cache-first UX.
Tasks
Task A: Cache Infra Stability
Files:
apps/lib/data/cache/cache_store.dartapps/lib/data/cache/cache_policy.dartapps/lib/data/cache/cached_repository.dart
Checks:
flutter test apps/test/data/cache/cached_repository_test.dartflutter test apps/test/data/cache/hybrid_cache_store_test.dartflutter test apps/test/data/cache/shared_prefs_cache_store_test.dart
Task B: Feature Repositories Use Local TTL Policies
Files:
apps/lib/features/todo/data/repositories/todo_repository.dartapps/lib/features/messages/data/repositories/inbox_repository.dartapps/lib/features/contacts/data/repositories/friend_repository.dartapps/lib/features/settings/data/repositories/user_profile_cache_repository.dartapps/lib/features/chat/data/repositories/chat_history_repository.dartapps/lib/features/calendar/data/repositories/calendar_repository.dart
Checks:
flutter test apps/test/data/repositories/shared_repositories_test.dartflutter test apps/test/features/chat/data/repositories/chat_history_repository_test.dartflutter test apps/test/features/settings/data/repositories/user_profile_cache_repository_test.dart
Task C: Auth Boot Prewarm Gate
Files:
apps/lib/app/services/app_prewarm_orchestrator.dartapps/lib/app/router/app_router.dartapps/lib/features/auth/presentation/screens/auth_boot_screen.dartapps/lib/app/di/injection.dart
Checks:
flutter test apps/test/app/services/app_prewarm_orchestrator_test.dartflutter test apps/test/app/router/app_router_redirect_test.dart
Task D: Regression Safety
Checks:
flutter analyze- Run all tests from Tasks A/B/C together before finalizing.
Notes
- Any old path references from previous plan versions are obsolete.
- Notification/reminder data-interaction services are intentionally removed for separate rewrite.