refactor(profile): decompose profile into self-loading sections - #72
Conversation
Adds focused-response DTOs and ProfileApiClient methods for /profile/user, /profile/active-subscription, /profile/user-parameters, /profile/history and /profile/phase. Prepares profile sections to load their own data instead of slicing the monolithic /profile payload. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ProfilePhaseCubit owns phase snapshot and current phase summary, loads them from focused /profile/phase and statistics endpoints. ProfileStatisticsCubit no longer carries phase summary state. ProfileRepository.getPhaseSnapshot now uses the focused endpoint and drops the cross-populated phase cache field. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ProfileSubscriptionCubit now loads its own active subscription via /profile/active-subscription and resolves the matching catalog item, so ProfileSubscriptionSectionWidget no longer depends on the user cubit history snapshot. ProfileRefreshCubit listener also triggers the new cubit so the post-purchase reload path keeps working. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ProfileParametersCubit now seeds the form only from its own loadInitial() / submit() flow. Removed setBootstrapSnapshot, the bootstrapSnapshot state field, and the ProfilePage listener that proxied parameters from the monolithic /profile payload. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ProfileStatisticsCubit now requests the stats history snapshot itself during loadInitial, so the ProfileUserCubit listener no longer proxies history through setHistorySnapshot. ProfileStatsHistorySnapshot drops its activeSubscription field; the history dialog reads the active subscription directly from ProfileSubscriptionCubit. The repository stats history snapshot now hits the focused endpoint and the cache field disappears. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Delete ProfileRefreshCubit / ProfileRefreshState / .freezed.dart - Remove DI singleton registration (di.dart) - Remove BlocProvider.value from ProfilePageBuilder - Unwrap BlocListener in ProfilePage body - Remove requestRefresh() call from SubscriptionsDetailsPage - Drop getParametersSnapshot() from ProfileRepository interface (was never implemented; parameters live in ProfileParametersRepository) - Update docs/architecture.md: remove workaround mention, add note about self-contained section cubits after decomposition - Fix stale tests: profile_user_cubit_test, profile_repository_impl_test (align with apiClient.getUser() / ProfileUserOnlyResponseDto) flutter analyze --fatal-infos: no issues flutter test: 485/485 green
|
Warning Review limit reached
More reviews will be available in 49 minutes and 37 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (44)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why
The Profile screen was a single god-feature backed by the monolithic
GET /api/profileendpoint, with sections sharing data via cross-cubit snapshot proxying (ProfileUserCubit.historySnapshot/phaseSnapshot/parametersSnapshot,setBootstrapSnapshot,setHistorySnapshot) and aProfileRefreshCubitworkaround for cross-feature refresh signals.What
/profile/*endpoints (user,phase,user-parameters,history,active-subscription) toProfileApiClientwith matching DTOs and mappers.ProfileUserCubitnow owns only the user card (getUser()), all snapshot fields removed.ProfileRefreshCubitworkaround and its DI registration.