Fix feature flags silent failure and profile page infinite loading#3679
Conversation
- Add ?? false to isFeatureEnabled() call to prevent TypeError when PostHog returns null on fresh login with no local cache, which was silently disabling all feature flags for the entire session - Call reloadFlags() at startup after PostHog init so flags load for unauthenticated/guest users from first launch - Dispatch LoadUser in ProfilePage initState to retry if user data isn't already loaded, and add Retry button on UserLoadingError state
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe app now reloads feature flags during startup after PostHog setup, normalizes null flag checks to false, and updates the profile page to load user data on entry and retry from the error state. ChangesStartup and profile flow updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/mobile/lib/src/app/profile/pages/profile_page.dart`:
- Around line 22-30: Avoid triggering a duplicate user fetch from
profile_page.dart’s initState in ProfilePage: the current state check only
excludes UserLoaded, so UserLoading still falls through and dispatches
LoadUser() again. Update the condition to also skip dispatch when the UserBloc
state is already loading, using the existing UserBloc/UserLoaded/UserLoading
flow in initState so only one load can be enqueued at a time.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 65312af2-7390-4ddc-bddf-ea14fab78fb0
⛔ Files ignored due to path filters (1)
src/mobile/pubspec.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
src/mobile/lib/main.dartsrc/mobile/lib/src/app/profile/pages/profile_page.dartsrc/mobile/lib/src/app/shared/services/feature_flag_service.dart
There was a problem hiding this comment.
Pull request overview
This PR improves reliability of PostHog feature flags on fresh installs/logins and prevents the Profile page from getting stuck in a non-loaded state by proactively triggering user-load and offering a retry action.
Changes:
- Make feature-flag evaluation resilient to
nullresults from PostHog and trigger a flags refresh right after PostHog initialization. - On
ProfilePage, dispatchLoadUserduringinitStatewhen the user state isn’t already loading/loaded. - Add a Retry button to the profile error UI.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/mobile/pubspec.lock | Updates dependency resolution; also bumps the lockfile’s minimum Dart/Flutter SDK versions. |
| src/mobile/lib/src/app/shared/services/feature_flag_service.dart | Defaults feature flags to false when PostHog returns null. |
| src/mobile/lib/main.dart | Reloads feature flags immediately after PostHog setup. |
| src/mobile/lib/src/app/profile/pages/profile_page.dart | Triggers user reload on page init and adds Retry UI on load failure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Summary by CodeRabbit
false.