diff --git a/src/lib/features/feature-toggle/feature-toggle-service.ts b/src/lib/features/feature-toggle/feature-toggle-service.ts index c5e16e0f59ad..14a4b6680fa3 100644 --- a/src/lib/features/feature-toggle/feature-toggle-service.ts +++ b/src/lib/features/feature-toggle/feature-toggle-service.ts @@ -983,28 +983,14 @@ class FeatureToggleService { await this.featureStrategiesStore.delete(id); - const featureStrategies = - await this.featureStrategiesStore.getStrategiesForFeatureEnv( - projectId, - featureName, - environment, - ); - - const hasOnlyDisabledStrategies = featureStrategies.every( - (strategy) => strategy.disabled, + // Disable the feature in the environment if it only has disabled strategies + await this.optionallyDisableFeature( + featureName, + environment, + projectId, + auditUser, ); - if (hasOnlyDisabledStrategies) { - // Disable the feature in the environment if it only has disabled strategies - await this.unprotectedUpdateEnabled( - projectId, - featureName, - environment, - false, - auditUser, - ); - } - const preData = this.featureStrategyToPublic(existingStrategy); await this.eventService.storeEvent(