From 75f255f6001eac60d767465c856360acfb3d68dc Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 13:27:43 +0000 Subject: [PATCH 1/2] chore: remove logged_out_key_factors_variant feature flag Drops the PostHog A/B flag and the hook that consumed it, so key factors are always shown regardless of auth state. Co-authored-by: Sylvain <74110469+SylvainChevalier@users.noreply.github.com> --- .../components/key_factors/key_factors_comment_section.tsx | 5 +---- .../key_factors/key_factors_question_consumer_section.tsx | 4 ---- .../components/key_factors/key_factors_question_section.tsx | 4 ---- .../questions_feed_view/key_factors_tile_view.tsx | 4 ---- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_comment_section.tsx b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_comment_section.tsx index 4b6df1a9ac..ffb0cb399d 100644 --- a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_comment_section.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_comment_section.tsx @@ -6,7 +6,6 @@ import { FC } from "react"; import { useKeyFactorDelete } from "@/app/(main)/questions/[id]/components/key_factors/hooks"; import { KeyFactorItem } from "@/app/(main)/questions/[id]/components/key_factors/item_view"; import KeyFactorsCarousel from "@/app/(main)/questions/[id]/components/key_factors/key_factors_carousel"; -import { useShouldHideKeyFactors } from "@/app/(main)/questions/[id]/components/key_factors/use_should_hide_key_factors"; import { useQuestionLayoutSafe } from "@/app/(main)/questions/[id]/components/question_layout/question_layout_context"; import { useAuth } from "@/contexts/auth_context"; import { KeyFactor } from "@/types/comment"; @@ -32,15 +31,13 @@ const KeyFactorsCommentSection: FC = ({ const { user } = useAuth(); const questionLayout = useQuestionLayoutSafe(); const { openDeleteModal } = useKeyFactorDelete(); - const shouldHideKeyFactors = useShouldHideKeyFactors(); const canEdit = user?.id === authorId || permission === ProjectPermissions.ADMIN; const kfPostUrl = `${getPostLink(post)}#key-factors`; - // Don't render if there are no key factors for this comment or if hidden by A/B test - if (keyFactors.length === 0 || shouldHideKeyFactors) { + if (keyFactors.length === 0) { return null; } diff --git a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx index 8140cc7829..2fb5f95f3b 100644 --- a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_consumer_section.tsx @@ -17,7 +17,6 @@ import { import KeyFactorDetailOverlay from "./key_factor_detail_overlay"; import KeyFactorsCarousel from "./key_factors_carousel"; import KeyFactorsConsumerCarousel from "./key_factors_consumer_carousel"; -import { useShouldHideKeyFactors } from "./use_should_hide_key_factors"; import { useQuestionLayout } from "../question_layout/question_layout_context"; type Props = { @@ -33,15 +32,12 @@ const KeyFactorsQuestionConsumerSection: FC = ({ post }) => { openKeyFactorOverlay, closeKeyFactorOverlay, } = useQuestionLayout(); - const shouldHideKeyFactors = useShouldHideKeyFactors(); const { items: topItems, totalCount } = useTopKeyFactorsCarouselItems({ keyFactors, limit: MAX_TOP_KEY_FACTORS, }); - if (shouldHideKeyFactors) return null; - if (post.status === PostStatus.RESOLVED) return null; const postForecastAvailability = isQuestionPost(post) diff --git a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_section.tsx b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_section.tsx index b4ce4298be..a749530a18 100644 --- a/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_section.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/key_factors/key_factors_question_section.tsx @@ -18,7 +18,6 @@ import { sendAnalyticsEvent } from "@/utils/analytics"; import { getKeyFactorsLimits } from "./hooks"; import { useTopKeyFactorsCarouselItems } from "./hooks/use_top_key_factors_carousel_items"; import KeyFactorsConsumerCarousel from "./key_factors_consumer_carousel"; -import { useShouldHideKeyFactors } from "./use_should_hide_key_factors"; type KeyFactorsQuestionSectionProps = { post: PostWithForecasts; @@ -46,7 +45,6 @@ const KeyFactorsQuestionSection: FC = ({ const { user } = useAuth(); const { keyFactorsExpanded } = useQuestionLayoutSafe() ?? {}; const { combinedKeyFactors } = useCommentsFeed(); - const shouldHideKeyFactors = useShouldHideKeyFactors(); const [isSectionExpanded, setIsSectionExpanded] = useState(false); const { aggregateCoherenceLinks } = useCoherenceLinksContext(); @@ -80,8 +78,6 @@ const KeyFactorsQuestionSection: FC = ({ } }, [combinedKeyFactors]); - if (shouldHideKeyFactors) return null; - if ( CLOSED_STATUSES.includes(postStatus) && combinedKeyFactors.length === 0 && diff --git a/front_end/src/app/(main)/questions/[id]/components/key_factors/questions_feed_view/key_factors_tile_view.tsx b/front_end/src/app/(main)/questions/[id]/components/key_factors/questions_feed_view/key_factors_tile_view.tsx index 4f8388786e..dfa8bb0e45 100644 --- a/front_end/src/app/(main)/questions/[id]/components/key_factors/questions_feed_view/key_factors_tile_view.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/key_factors/questions_feed_view/key_factors_tile_view.tsx @@ -30,7 +30,6 @@ import { KeyFactorTileQuestionLinkView, type Props as KfDisplayProps, } from "./key_factor_tile_view"; -import { useShouldHideKeyFactors } from "../use_should_hide_key_factors"; import { isDisplayableQuestionLink } from "../utils"; type Props = { @@ -67,7 +66,6 @@ const KeyFactorsTileView: React.FC = ({ className, }) => { const t = useTranslations(); - const shouldHideKeyFactors = useShouldHideKeyFactors(); const [expandedIds, setExpandedIds] = useState>([]); const [isQuestionLinkExpanded, setIsQuestionLinkExpanded] = useState(false); @@ -227,8 +225,6 @@ const KeyFactorsTileView: React.FC = ({ ); }, []); - if (shouldHideKeyFactors) return null; - if (post.status === PostStatus.RESOLVED) return null; if (items.length === 0 && !questionLinkDisplay) return null; From 16937b1b33eda4a7b4338de4fa13e3b5005426bc Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 13:27:49 +0000 Subject: [PATCH 2/2] chore: delete unused useShouldHideKeyFactors hook Co-authored-by: Sylvain <74110469+SylvainChevalier@users.noreply.github.com> --- .../use_should_hide_key_factors.ts | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 front_end/src/app/(main)/questions/[id]/components/key_factors/use_should_hide_key_factors.ts diff --git a/front_end/src/app/(main)/questions/[id]/components/key_factors/use_should_hide_key_factors.ts b/front_end/src/app/(main)/questions/[id]/components/key_factors/use_should_hide_key_factors.ts deleted file mode 100644 index 96b7b88061..0000000000 --- a/front_end/src/app/(main)/questions/[id]/components/key_factors/use_should_hide_key_factors.ts +++ /dev/null @@ -1,20 +0,0 @@ -"use client"; - -import { isNil } from "lodash"; -import { useFeatureFlagVariantKey } from "posthog-js/react"; - -import { useAuth } from "@/contexts/auth_context"; - -const FLAG_KEY = "logged_out_key_factors_variant"; - -export function useShouldHideKeyFactors(): boolean { - const { user } = useAuth(); - const flagVariant = useFeatureFlagVariantKey(FLAG_KEY); - - // Only hide for logged-out users with "hidden" variant - if (isNil(user) && flagVariant === "hidden") { - return true; - } - - return false; -}