-
Notifications
You must be signed in to change notification settings - Fork 71
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: one parent dependency check #531
Conversation
@@ -131,7 +125,7 @@ export default class UnleashClient extends EventEmitter { | |||
return { enabled: fallback() }; | |||
} | |||
|
|||
if (!feature || !feature.enabled) { | |||
if (!feature || !this.isParentDependencySatisfied(feature, context) || !feature.enabled) { |
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.
by moving parent dependency check to isFeatureEnabled we can simplify isEnabled method and resolveVariant since both of those methods call isFeatureEnabled under the hood.
@@ -131,7 +125,7 @@ export default class UnleashClient extends EventEmitter { | |||
return { enabled: fallback() }; | |||
} | |||
|
|||
if (!feature || !feature.enabled) { | |||
if (!feature || !this.isParentDependencySatisfied(feature, context) || !feature.enabled) { |
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.
if (!feature || !this.isParentDependencySatisfied(feature, context) || !feature.enabled) { | |
if (!feature || !feature.enabled || !this.isParentDependencySatisfied(feature, context)) { |
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.
I wanted to be backwards compatible and check dependency before the feature itself. We had a failing test otherwise. Of course we can change the assumption.
About the changes
Reduced number of calls to parent dependency check.
Important files
Discussion points