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

Merged
merged 4 commits into from
Jan 13, 2025

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

Closes https://github.com/getsentry/team-replay/issues/529

@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.

Copy link
Member

@cmanallen cmanallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per @antonpirker's comment we can no longer rely on the context being present. getsentry/sentry-python#3917 (comment)

Copy link
Member

@cmanallen cmanallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After offline discussion, we need the flags context check.

@michellewzhang michellewzhang merged commit 6b70d1a into master Jan 13, 2025
48 checks passed
@michellewzhang michellewzhang deleted the mz/has-flags-flag-fe branch January 13, 2025 20:53
andrewshie-sentry pushed a commit that referenced this pull request Jan 22, 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

<img width="870" alt="SCR-20250110-nkne"
src="https://github.com/user-attachments/assets/595d0e2e-8c5f-42f6-aa16-2ee5bcead68d"
/>


## `event.contexts.flags = [ ]` -> empty state
<img width="849" alt="SCR-20250110-nlkr"
src="https://github.com/user-attachments/assets/af07507e-e177-4c73-979b-4ea652eb73c2"
/>


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

<img width="849" alt="SCR-20250110-nlkr"
src="https://github.com/user-attachments/assets/af07507e-e177-4c73-979b-4ea652eb73c2"
/>

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

<img width="846" alt="SCR-20250110-nkul"
src="https://github.com/user-attachments/assets/07e123a3-fcab-48da-acd0-62d89a9d6a6b"
/>



## `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


Closes getsentry/team-replay#529
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.

2 participants