Hide key factors to 10% of logged out users#4232
Conversation
Fixes #4168 - Added `useShouldHideKeyFactors` hook to determine visibility based on user authentication and feature flag. - Updated `KeyFactorsCommentSection`, `KeyFactorsQuestionConsumerSection`, and `KeyFactorsQuestionSection` to conditionally render based on the new hook. - Integrated the hook into `KeyFactorsTileView` to enhance user experience by hiding key factors for logged-out users when the feature flag is active.
📝 WalkthroughWalkthroughThis PR implements A/B testing for key factors visibility by introducing a new hook that checks if a user is logged out and if a PostHog feature flag variant is set to "hidden", then applies conditional rendering across four key factors components. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used🧬 Code graph analysis (4)front_end/src/app/(main)/questions/[id]/components/key_factors/questions_feed_view/key_factors_tile_view.tsx (1)
front_end/src/app/(main)/questions/[id]/components/key_factors/use_should_hide_key_factors.ts (1)
front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_section.tsx (1)
front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_comment_section.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (5)
✏️ Tip: You can disable this entire section by setting 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 |
|
@ncarazon can you please check posthog variant setup to see if it's configured correctly? |
🧹 Preview Environment Cleaned UpThe preview environment for this PR has been destroyed.
Cleanup triggered by PR close at 2026-02-05T11:03:53Z |
Fixes #4168
useShouldHideKeyFactorshook to determine visibility based on user authentication and feature flag.KeyFactorsCommentSection,KeyFactorsQuestionConsumerSection, andKeyFactorsQuestionSectionto conditionally render based on the new hook.KeyFactorsTileViewto enhance user experience by hiding key factors for logged-out users when the feature flag is active.Summary by CodeRabbit