From a08bada1def8261e1117c174e00012eea1e55951 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Tue, 12 Mar 2024 14:41:25 +0200 Subject: [PATCH] feat: do not return disabled features to FE api (#6520) --- .../features/frontend-api/client-feature-toggle-read-model.ts | 3 ++- src/lib/features/frontend-api/global-frontend-api-cache.ts | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/features/frontend-api/client-feature-toggle-read-model.ts b/src/lib/features/frontend-api/client-feature-toggle-read-model.ts index fada749285..191aa8e520 100644 --- a/src/lib/features/frontend-api/client-feature-toggle-read-model.ts +++ b/src/lib/features/frontend-api/client-feature-toggle-read-model.ts @@ -84,7 +84,8 @@ export default class ClientFeatureToggleReadModel `fs.id`, ) .leftJoin('segments', `segments.id`, `fss.segment_id`) - .leftJoin('dependent_features as df', 'df.child', 'features.name'); + .leftJoin('dependent_features as df', 'df.child', 'features.name') + .where('fe.enabled', true); query = query.select(selectColumns); const rows = await query; diff --git a/src/lib/features/frontend-api/global-frontend-api-cache.ts b/src/lib/features/frontend-api/global-frontend-api-cache.ts index 6f51e4cda9..e930e4201f 100644 --- a/src/lib/features/frontend-api/global-frontend-api-cache.ts +++ b/src/lib/features/frontend-api/global-frontend-api-cache.ts @@ -110,7 +110,6 @@ export class GlobalFrontendApiCache extends EventEmitter { } // TODO: fetch only relevant projects/environments based on tokens - // TODO: also consider not fetching disabled features, because those are not returned by frontend API private async refreshData() { try { const stopTimer = this.timer('refreshData');