Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(project): use hasFlags flag for CTA check #83282

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michellewzhang
Copy link
Member

@michellewzhang michellewzhang commented Jan 10, 2025

use the newly implemented hasFlags project flag as the final layer to determine whether the CTA should be shown.

TLDR: the CTA only shows up if... project has never sent flags before, event.contexts.flags is undefined, the platform is correct, & the org is under the cta flag.

const showCTA =
    !project.hasFlags &&
    !hasFlagContext &&
    featureFlagOnboardingPlatforms.includes(project.platform ?? 'other') &&
    organization.features.includes('feature-flag-cta');

here are the following possible code paths (all are tested)

event.contexts.flags = [ ... ] -> flag table rendered

SCR-20250110-nkne

event.contexts.flags = [ ] -> empty state

SCR-20250110-nlkr

event.contexts.flags = undefined and hasFlags = true -> empty state

SCR-20250110-nlkr

event.contexts.flags = undefined and hasFlags = false and feature-flag-cta = true and platform in [javascript, python] -> CTA shown

SCR-20250110-nkul

event.contexts.flags = undefined and feature-flag-cta = true and platform !in [javascript, python] -> section hidden

event.contexts.flags = undefined and feature-flag-cta = false -> section hidden

@michellewzhang michellewzhang requested review from a team as code owners January 10, 2025 23:11
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 10, 2025

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant