feat(billing): gate billing page behind feature flag#915
Conversation
📝 WalkthroughWalkthroughAdded a BILLING_ENABLED feature flag and used it to gate billing UI: routes now await the flag, redirect to /settings/account when disabled, and the settings sidebar filters out billing when the flag is off. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
4fe6779 to
fb9348b
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@apps/desktop/src/renderer/routes/_authenticated/settings/billing/page.tsx`:
- Around line 24-26: The redirect runs too early because useFeatureFlagEnabled
returns undefined while loading; change the guard so you only redirect when the
flag is explicitly false and not while it's undefined — e.g., in the component
that calls useFeatureFlagEnabled(billingFlag) check for billingEnabled ===
undefined and return a loading/null placeholder, and only do the Navigate
redirect when billingEnabled === false; reference the hook useFeatureFlagEnabled
and the billingEnabled variable and the existing Navigate usage when making the
change.
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/billing/plans/page.tsx`:
- Around line 15-17: The current redirect uses the truthiness of billingEnabled
(from useFeatureFlagEnabled) and fires while the flag is still loading
(undefined); change the check to only redirect when the flag has explicitly
resolved to false and handle the loading case separately: update the conditional
around billingEnabled in the component (the variable from useFeatureFlagEnabled)
to something like if (billingEnabled === undefined) return null or a loader, and
only return <Navigate to="/settings/account" /> when billingEnabled === false so
you don't redirect prematurely.
🧹 Nitpick comments (1)
apps/desktop/src/renderer/routes/_authenticated/settings/components/SettingsSidebar/GeneralSettings.tsx (1)
100-107: Consider handling the loading state for consistency.Similar to the billing route pages,
useFeatureFlagEnabledreturnsundefinedwhile loading. This causes the billing section to briefly disappear from the sidebar before the flag resolves—even for users who have access.The impact here is less severe than the route redirects (just a visual flicker), but for a consistent user experience, consider handling the undefined state:
Proposed fix
// When searching, only show sections that have matches // Also hide billing section if feature flag is disabled const filteredSections = ( matchCounts ? GENERAL_SECTIONS.filter( (section) => (matchCounts[section.section] ?? 0) > 0, ) : GENERAL_SECTIONS - ).filter((section) => section.section !== "billing" || billingEnabled); + ).filter((section) => section.section !== "billing" || billingEnabled !== false);This treats
undefined(loading) the same astrue, showing billing until we know definitively that it should be hidden.
fb9348b to
ed2aadf
Compare
be1f0ec to
5a4a54a
Compare
Hide billing settings from users who don't have the billing-enabled feature flag. Uses centralized FEATURE_FLAGS constant from shared.
5a4a54a to
b7ee5b3
Compare
Fix lint issues from PR #910: - Add biome-ignore for useEffect in wave animation - Format code to pass biome checks
de2b15c to
6d72c99
Compare
Hide billing page from users without @superset.sh email until Stripe account is fully configured.
Uses PostHog feature flag
billing-enabled(defined inFEATURE_FLAGS.BILLING_ENABLED) which is set to only allow users with @superset.sh emails.Changes:
BILLING_ENABLEDto shared constantsSummary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.