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: one parent dependency check #531

Merged
merged 1 commit into from
Oct 18, 2023
Merged

Conversation

kwasniew
Copy link
Contributor

About the changes

Reduced number of calls to parent dependency check.

Important files

Discussion points

@github-actions
Copy link

Coverage Status

coverage: 91.466% (-0.1%) from 91.564% when pulling 297bea2 on one-parent-dependency-check into d7637a8 on main.

@@ -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) {
Copy link
Contributor Author

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) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!feature || !this.isParentDependencySatisfied(feature, context) || !feature.enabled) {
if (!feature || !feature.enabled || !this.isParentDependencySatisfied(feature, context)) {

Copy link
Contributor Author

@kwasniew kwasniew Oct 18, 2023

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.

@kwasniew kwasniew merged commit c32de90 into main Oct 18, 2023
5 checks passed
@kwasniew kwasniew deleted the one-parent-dependency-check branch October 18, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants