From 9c8651879f12379d6d8d5a1e1a5384879be8b256 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Mon, 19 Jun 2023 13:42:55 +0300 Subject: [PATCH] fix: filter out usage for export (#4006) --- .../export-import-service.ts | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/lib/features/export-import-toggles/export-import-service.ts b/src/lib/features/export-import-toggles/export-import-service.ts index 39da3d130a..ba3cb7d56b 100644 --- a/src/lib/features/export-import-toggles/export-import-service.ts +++ b/src/lib/features/export-import-toggles/export-import-service.ts @@ -587,27 +587,32 @@ export default class ExportImportService { this.tagTypeStore.getAll(), ]); this.addSegmentsToStrategies(featureStrategies, strategySegments); - const filteredContextFields = contextFields.filter( - (field) => - featureEnvironments.some((featureEnv) => - featureEnv.variants?.some( - (variant) => - variant.stickiness === field.name || - variant.overrides?.some( - (override) => - override.contextName === field.name, + const filteredContextFields = contextFields + .filter( + (field) => + featureEnvironments.some((featureEnv) => + featureEnv.variants?.some( + (variant) => + variant.stickiness === field.name || + variant.overrides?.some( + (override) => + override.contextName === field.name, + ), + ), + ) || + featureStrategies.some( + (strategy) => + strategy.parameters.stickiness === field.name || + strategy.constraints.some( + (constraint) => + constraint.contextName === field.name, ), ), - ) || - featureStrategies.some( - (strategy) => - strategy.parameters.stickiness === field.name || - strategy.constraints.some( - (constraint) => - constraint.contextName === field.name, - ), - ), - ); + ) + .map((item) => { + const { usedInFeatures, usedInProjects, ...rest } = item; + return rest; + }); const filteredSegments = segments.filter((segment) => featureStrategies.some((strategy) => strategy.segments?.includes(segment.id),