-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
feat: dependent features in playground #4930
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
return !feature.strategies?.data?.find((strategy) => | ||
DEFAULT_STRATEGIES.includes(strategy.name), | ||
return ( | ||
feature.strategies?.data?.length > 0 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a bug when strategies were an empty list
@@ -19,6 +19,7 @@ export interface PlaygroundFeatureSchema { | |||
strategies: PlaygroundFeatureSchemaStrategies; | |||
/** Whether the feature is active and would be evaluated in the provided environment in a normal SDK context. */ | |||
isEnabledInCurrentEnvironment: boolean; | |||
hasUnsatisfiedParent: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be generated with orval with next PR, this one is added manually
@@ -57,13 +58,63 @@ export default class UnleashClient { | |||
); | |||
} | |||
|
|||
isParentDependencySatisfied( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copied from Node SDK with minor tweaks
if (!feature.isEnabledInCurrentEnvironment) { | ||
return 'If environment was enabled'; | ||
} | ||
return ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not occur, will take care of it with the next PR with extensive test suite
@@ -19,6 +19,7 @@ export interface PlaygroundFeatureSchema { | |||
strategies: PlaygroundFeatureSchemaStrategies; | |||
/** Whether the feature is active and would be evaluated in the provided environment in a normal SDK context. */ | |||
isEnabledInCurrentEnvironment: boolean; | |||
hasUnsatisfiedParent?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be auto generated from orval, for now I added it manually
@@ -3,5 +3,5 @@ import { FeatureDependency, FeatureDependencyId } from './dependent-features'; | |||
export interface IDependentFeaturesStore { | |||
upsert(featureDependency: FeatureDependency): Promise<void>; | |||
delete(dependency: FeatureDependencyId): Promise<void>; | |||
deleteAll(child: string): Promise<void>; | |||
deleteAll(child?: string): Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useful for test teardown
clientContext, | ||
), | ||
variant: isEnabled | ||
? client.forceGetVariant( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this version of a client does not check feature enabled status this code was returning variants for disabled features. This PR fixes this bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this by design? "If this feature is enabled, it would return X variant"?
clientContext, | ||
), | ||
variant: isEnabled | ||
? client.forceGetVariant( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this by design? "If this feature is enabled, it would return X variant"?
About the changes
Playground can resolve dependent feature toggles
Parent dependency not satisfied UI
Parent dependency not satisfied and feature is disabled
Important files
Discussion points