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

refactor(admin-panel): standardize FeatureFlagKey usage #9548

Merged
merged 5 commits into from
Jan 10, 2025

Conversation

AMoreaux
Copy link
Contributor

Replaced string-based feature flag keys with the typed FeatureFlagKey enum across the admin panel module and related front-end hooks. This ensures stronger type safety, reduces potential errors, and improves consistency in handling feature flags.

Replaced string-based feature flag keys with the typed FeatureFlagKey enum across the admin panel module and related front-end hooks. This ensures stronger type safety, reduces potential errors, and improves consistency in handling feature flags.
@AMoreaux AMoreaux requested a review from Weiko January 10, 2025 16:33
@AMoreaux AMoreaux self-assigned this Jan 10, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR standardizes feature flag handling by implementing a strongly-typed FeatureFlagKey enum across the admin panel module, replacing string-based keys for improved type safety and consistency.

  • Refactored useFeatureFlagsManagement.ts hook to use typed FeatureFlagKey enum with optimistic updates and error rollback
  • Updated admin-panel.service.ts to handle enum-based feature flag keys in updateWorkspaceFeatureFlags method
  • Modified FeatureFlag.ts type definition to enforce strict typing with FeatureFlagKey enum from GraphQL types
  • Simplified admin-panel.resolver.ts by removing redundant enum lookups and using direct feature flag key passing

4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Replaced string literals with strongly typed `FeatureFlagKey` enum for feature flag definitions in admin panel tests. This enhances type safety, prevents potential errors, and ensures better code consistency.
Replaced string literals with strongly typed `FeatureFlagKey` enum for feature flag definitions in admin panel tests. This enhances type safety, prevents potential errors, and ensures better code consistency.
@charlesBochet charlesBochet merged commit b40f58a into main Jan 10, 2025
21 of 23 checks passed
@charlesBochet charlesBochet deleted the fix/feature-flag-toggle branch January 10, 2025 17:38
Copy link

Fails
🚫

node failed.

Log

�[31mError: �[39m SyntaxError: Unexpected token C in JSON at position 0
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:5555:27)�[39m
�[90m    at fullyReadBody (node:internal/deps/undici/undici:1665:9)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m
�[90m    at async specConsumeBody (node:internal/deps/undici/undici:5564:7)�[39m
danger-results://tmp/danger-results-619f6e80.json

Generated by 🚫 dangerJS against bf48ff4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants