diff --git a/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts b/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts index 487299d6c..13b5f1b78 100644 --- a/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts +++ b/packages/shared/sdk-client/__tests__/LDCLientImpl.inspections.test.ts @@ -187,5 +187,7 @@ it('calls flag-details-changed inspectors when all flag values change', async () 'moonshot-demo': { reason: null, value: true, variationIndex: 0 }, test1: { reason: null, value: 's1', variationIndex: 0 }, 'this-is-a-test': { reason: null, value: true, variationIndex: 0 }, + 'has-prereq-depth-1': { reason: { kind: 'FALLTHROUGH' }, value: true, variationIndex: 0 }, + 'is-prereq': { reason: { kind: 'FALLTHROUGH' }, value: true, variationIndex: 0 }, }); }); diff --git a/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts b/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts index cb94cae82..66a5d5713 100644 --- a/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts +++ b/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts @@ -19,10 +19,13 @@ export function createSuccessEvaluationDetail( reason?: LDEvaluationReason, prerequisites?: string[], ): LDEvaluationDetail { - return { + const res: LDEvaluationDetail = { value, variationIndex: variationIndex ?? null, reason: reason ?? null, - prerequisites, }; + if (prerequisites) { + res.prerequisites = prerequisites; + } + return res; }