feat(buttons): engagement bar -> CardAction behind GrowthBook flag#6064
Open
tsahimatsliah wants to merge 1 commit into
Open
feat(buttons): engagement bar -> CardAction behind GrowthBook flag#6064tsahimatsliah wants to merge 1 commit into
tsahimatsliah wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Wires the V2 `CardAction` / `CardActionBar` primitives behind the `engagement_bar_v2` GrowthBook flag, across all 8 engagement-bar surfaces (`PostActions`, `MobilePostFloatingBar`, feed-card `ActionButtons`, `PostAwardAction`, `CommentActionButtons`, reader rail + floating bars, profile `HotTakeItem`). Each surface is a dispatcher that renders the legacy V1 `QuaternaryButton` strip by default and the new V2 `CardAction` strip when the flag resolves true. Default state stays byte-for-byte identical to today's main. Includes: - `useEngagementBarV2` hook gated on `isAuthReady && !!user` so anonymous + pre-hydration users skip the GrowthBook evaluation entirely (no exposure, no eval cost). - `BookmarkButton.v2` sibling so V2 dispatcher code can target the V2 API surface without disturbing the V1 component. - `CardAction` / `CardActionBar` forwardRef + `displayName` for DevTools / test selectors. - `usePostActionsLabelVisibility` (ResizeObserver-based responsive label collapse, copied from the consolidated branch). - Reader V2 surfaces log mutation failures via `console.error` instead of swallowing them silently, matching the dev-tools- surfacing pattern. - Spec coverage for `useEngagementBarV2` (anonymous bypass, auth-readiness gate, flag-on / flag-off resolution). Co-authored-by: Cursor <cursoragent@cursor.com>
454f300 to
6a5dca4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the 9 engagement-bar surfaces from the legacy `QuaternaryButton` strip to the new `CardAction` / `CardActionBar` primitives, but ships every change gated behind a new `engagement_bar_v2` GrowthBook feature flag — default OFF — so the existing bar stays the live experience and we ramp progressively (1% -> 10% -> 100%) with a kill-switch.
Why a feature flag
The action bar is the most-rendered UI in the product: every feed card, every post detail page, every comment row, every reader session. Even though V2 looks similar to V1 after the reskin, the DOM, ARIA semantics, and CSS tree are different:
A small-percent ramp catches analytics, a11y, and responsive regressions before they reach 100% of traffic. Killing the flag instantly reverts every surface — no redeploy.
Approach: dispatcher pattern, not in-place rewrite
Every surface keeps two implementations side-by-side:
```tsx
// Original file (e.g. PostActions.tsx) becomes a 5-line dispatcher:
export function PostActions(props: PostActionsProps): ReactElement {
const useV2 = useEngagementBarV2();
if (useV2) return <PostActionsV2 {...props} />;
return <PostActionsV1 {...props} />;
}
```
Files
New (11)
Modified (14)
Skipped vs the consolidated branch
Verification
Test plan
Flag OFF (default state — what production sees on merge)
Flag ON (force-enable in GrowthBook dev/local)
Rollout plan (post-merge)
Made with Cursor
Preview domain
https://feat-engagement-bar-cardaction.preview.app.daily.dev