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

Initialize feature flag state on the server #4295

Merged
merged 3 commits into from
May 15, 2024

Conversation

obulat
Copy link
Contributor

@obulat obulat commented May 9, 2024

Fixes

Fixes #4223 by @obulat

Description

This PR sets the flag states on the server init based on the DEPLOYMENT_ENV env variable, instead of checking the state every time we access the flag.

The filtering of flags by switchable or by feature groups was moved to the store, too, to simplify the component code.

Testing instructions

The CI checks preferences and sensitive toggle, so the CI passing is a good indicator.
Go to /preferences and see that the features are displayed correctly and can be toggled.

@obulat obulat requested a review from a team as a code owner May 9, 2024 12:21
@github-actions github-actions bot added the 🧱 stack: frontend Related to the Nuxt frontend label May 9, 2024
@openverse-bot openverse-bot added the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label May 9, 2024
@obulat obulat mentioned this pull request May 9, 2024
6 tasks
@obulat obulat added 🟨 priority: medium Not blocking but should be addressed soon 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels May 9, 2024
@obulat obulat requested a review from dhruvkb May 9, 2024 12:22
@obulat obulat force-pushed the fix/evaluate-feature-flag-at-init branch 3 times, most recently from 909d75f to 839da3d Compare May 10, 2024 03:18
@obulat obulat self-assigned this May 10, 2024
Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

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

Great refactor, works as expected.

frontend/test/unit/specs/stores/search-store.spec.js Outdated Show resolved Hide resolved
@obulat obulat force-pushed the fix/evaluate-feature-flag-at-init branch from 839da3d to bc36749 Compare May 13, 2024 08:37
Copy link
Collaborator

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM, but one small blocker on the test setup/cleanup when modifying process.env. It's a blocker because the environment for those tests will leak into others if they themselves fail, potentially causing false-positives/negatives which would be confusing when debugging the specific failure of either of those two tests.

@@ -8,8 +8,8 @@
it doesn't count as a user preference.
-->
<div
v-for="(group, groupIndex) in featureData.groups"
:key="groupIndex"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oof! Good catch to change this to a stable value 😰

frontend/test/unit/specs/stores/feature-flag-store.spec.js Outdated Show resolved Hide resolved
frontend/test/unit/specs/stores/feature-flag-store.spec.js Outdated Show resolved Hide resolved
@obulat obulat force-pushed the fix/evaluate-feature-flag-at-init branch from bc36749 to 53014e4 Compare May 14, 2024 12:05
Copy link
Collaborator

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM! Glad for the comprehensive tests 🎉

@obulat obulat merged commit 292946e into main May 15, 2024
44 checks passed
@obulat obulat deleted the fix/evaluate-feature-flag-at-init branch May 15, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Initialize the feature flag store state on server request
4 participants