feat(inbox): Gate Inbox preview behind inbox-gated-due-to-scale flag#1960
feat(inbox): Gate Inbox preview behind inbox-gated-due-to-scale flag#1960posthog[bot] wants to merge 1 commit intomainfrom
Conversation
Show a teaser pane to large customers (gated via PostHog feature flag) while self-driving Inbox rolls out. The teaser invites the user to register interest, capturing an event that PostHog can use to track demand per org. Generated-By: PostHog Code Task-Id: 0aec9747-6100-4e9c-8948-e57a8babf58e
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/code/src/renderer/features/inbox/components/InboxEmptyStates.tsx:136
**Ephemeral registered state allows duplicate analytics events**
`registered` is `useState(false)`, so it resets to `false` every time `GatedDueToScalePane` unmounts (i.e., every navigation away from and back to Inbox). A user can fire `INBOX_INTEREST_REGISTERED` on every visit. If you want to track unique registrations accurately, persist the flag to `localStorage` (or treat the analytics event as idempotent and deduplicate server-side).
### Issue 2 of 2
apps/code/src/renderer/features/inbox/components/InboxView.tsx:10
**Brief flash of `InboxSignalsTab` for gated customers**
`useFeatureFlag` initialises to `false` (its `defaultValue`) when PostHog flags haven't loaded yet (see `useFeatureFlag.ts` lines 8–9). Until the `onFeatureFlagsLoaded` callback fires, `isGatedDueToScale` is `false`, so gated customers briefly see `InboxSignalsTab` before the gate pane replaces it. If flags are reliably loaded before the Inbox is reachable this is a non-issue, but if there's any race at startup it's worth adding a loading guard or initialising with `null` and rendering a neutral state until the flag resolves.
Reviews (1): Last reviewed commit: "feat(inbox): gate Inbox preview behind i..." | Re-trigger Greptile |
| @@ -130,6 +134,78 @@ export function WarmingUpPane({ | |||
| ); | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
Ephemeral registered state allows duplicate analytics events
registered is useState(false), so it resets to false every time GatedDueToScalePane unmounts (i.e., every navigation away from and back to Inbox). A user can fire INBOX_INTEREST_REGISTERED on every visit. If you want to track unique registrations accurately, persist the flag to localStorage (or treat the analytics event as idempotent and deduplicate server-side).
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/inbox/components/InboxEmptyStates.tsx
Line: 136
Comment:
**Ephemeral registered state allows duplicate analytics events**
`registered` is `useState(false)`, so it resets to `false` every time `GatedDueToScalePane` unmounts (i.e., every navigation away from and back to Inbox). A user can fire `INBOX_INTEREST_REGISTERED` on every visit. If you want to track unique registrations accurately, persist the flag to `localStorage` (or treat the analytics event as idempotent and deduplicate server-side).
How can I resolve this? If you propose a fix, please make it concise.| import { GatedDueToScalePane } from "./InboxEmptyStates"; | ||
| import { InboxSignalsTab } from "./InboxSignalsTab"; | ||
|
|
||
| export function InboxView() { |
There was a problem hiding this comment.
Brief flash of
InboxSignalsTab for gated customers
useFeatureFlag initialises to false (its defaultValue) when PostHog flags haven't loaded yet (see useFeatureFlag.ts lines 8–9). Until the onFeatureFlagsLoaded callback fires, isGatedDueToScale is false, so gated customers briefly see InboxSignalsTab before the gate pane replaces it. If flags are reliably loaded before the Inbox is reachable this is a non-issue, but if there's any race at startup it's worth adding a loading guard or initialising with null and rendering a neutral state until the flag resolves.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/inbox/components/InboxView.tsx
Line: 10
Comment:
**Brief flash of `InboxSignalsTab` for gated customers**
`useFeatureFlag` initialises to `false` (its `defaultValue`) when PostHog flags haven't loaded yet (see `useFeatureFlag.ts` lines 8–9). Until the `onFeatureFlagsLoaded` callback fires, `isGatedDueToScale` is `false`, so gated customers briefly see `InboxSignalsTab` before the gate pane replaces it. If flags are reliably loaded before the Inbox is reachable this is a non-issue, but if there's any race at startup it's worth adding a loading guard or initialising with `null` and rendering a neutral state until the flag resolves.
How can I resolve this? If you propose a fix, please make it concise.
Problem
Self-driving Inbox is still in preview, and we want to throttle who sees it in terms of large customers (let's say, >=$500 MRR). These folks should hit a teaser instead of the actual Inbo for now, with a simple way to register interest.
Changes
New PostHog boolean feature flag
inbox-gated-due-to-scale(created in PostHog via MCP server 🎉 targets theorganizationgroup withmrr≥ 500 at 100% rollout).For customers with this flag enabled, instead of
InboxSignalsTabcontents we renderGatedDueToScalePane.Clicking "Let me know when self-driving is available for my organization" fires a typed
Inbox interest registeredevent.Slack convo where @abhischekt helped out a lot with the gating logic here: https://posthog.slack.com/archives/C01MGUHFH6G/p1777552501110089
~@Twixes
Created with PostHog Code