@@ -102,7 +102,7 @@ export default class Evaluator {
102
102
const state = new EvalState ( ) ;
103
103
const res = await this . evaluateInternal ( flag , context , state , [ ] , eventFactory ) ;
104
104
if ( state . bigSegmentsStatus ) {
105
- res . detail . reason . bigSegmentsStatus = state . bigSegmentsStatus ;
105
+ res . detail . reason = { ... res . detail . reason , bigSegmentsStatus : state . bigSegmentsStatus } ;
106
106
}
107
107
res . events = state . events ;
108
108
return res ;
@@ -465,9 +465,11 @@ export default class Evaluator {
465
465
state : EvalState ,
466
466
segmentsVisited : string [ ]
467
467
) : Promise < MatchOrError > {
468
- const includeExclude = matchSegmentTargets ( segment , context ) ;
469
- if ( includeExclude !== undefined ) {
470
- return new Match ( includeExclude ) ;
468
+ if ( ! segment . unbounded ) {
469
+ const includeExclude = matchSegmentTargets ( segment , context ) ;
470
+ if ( includeExclude !== undefined ) {
471
+ return new Match ( includeExclude ) ;
472
+ }
471
473
}
472
474
473
475
let evalResult : EvalResult | undefined ;
@@ -501,6 +503,13 @@ export default class Evaluator {
501
503
return this . simpleSegmentMatchContext ( segment , context , state , segmentsVisited ) ;
502
504
}
503
505
506
+ const bigSegmentKind = segment . unboundedContextKind || 'user' ;
507
+ const keyForBigSegment = context . key ( bigSegmentKind ) ;
508
+
509
+ if ( ! keyForBigSegment ) {
510
+ return new Match ( false ) ;
511
+ }
512
+
504
513
if ( ! segment . generation ) {
505
514
// Big Segment queries can only be done if the generation is known. If it's unset,
506
515
// that probably means the data store was populated by an older SDK that doesn't know
@@ -514,13 +523,6 @@ export default class Evaluator {
514
523
return new Match ( false ) ;
515
524
}
516
525
517
- const bigSegmentKind = segment . unboundedContextKind || 'user' ;
518
- const keyForBigSegment = context . key ( bigSegmentKind ) ;
519
-
520
- if ( keyForBigSegment === undefined ) {
521
- return new Match ( false ) ;
522
- }
523
-
524
526
if ( state . bigSegmentsMembership && state . bigSegmentsMembership [ keyForBigSegment ] ) {
525
527
// We've already done the query at some point during the flag evaluation and stored
526
528
// the result (if any) in stateOut.bigSegmentsMembership, so we don't need to do it
@@ -572,8 +574,11 @@ export default class Evaluator {
572
574
) : Promise < MatchOrError > {
573
575
const segmentRef = makeBigSegmentRef ( segment ) ;
574
576
const included = membership ?. [ segmentRef ] ;
575
- if ( included ) {
576
- return new Match ( true ) ;
577
+ // Typically null is not checked because we filter it from the data
578
+ // we get in flag updates. Here it is checked because big segment data
579
+ // will be contingent on the store that implements it.
580
+ if ( included !== undefined && included !== null ) {
581
+ return new Match ( included ) ;
577
582
}
578
583
return this . simpleSegmentMatchContext ( segment , context , state , [ ] ) ;
579
584
}
0 commit comments