File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed
Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ export abstract class AbstractSplitsCacheSync implements ISplitsCacheSync {
8080 * Given a parsed split, it returns a boolean flagging if its conditions use segments matchers (rules & whitelists).
8181 * This util is intended to simplify the implementation of `splitsCache::usesSegments` method
8282 */
83- export function usesSegments ( split : ISplit | IRBSegment ) {
84- const conditions = split . conditions || [ ] ;
83+ export function usesSegments ( ruleEntity : ISplit | IRBSegment ) {
84+ const conditions = ruleEntity . conditions || [ ] ;
8585 for ( let i = 0 ; i < conditions . length ; i ++ ) {
8686 const matchers = conditions [ i ] . matcherGroup . matchers ;
8787
@@ -91,5 +91,8 @@ export function usesSegments(split: ISplit | IRBSegment) {
9191 }
9292 }
9393
94+ const excluded = ( ruleEntity as IRBSegment ) . excluded ;
95+ if ( excluded && excluded . segments && excluded . segments . length > 0 ) return true ;
96+
9497 return false ;
9598}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export class RBSegmentsCacheInLocal implements IRBSegmentsCacheSync {
3838 }
3939 }
4040
41- private updateSegmentCount ( diff : number ) {
41+ private updateSegmentCount ( diff : number ) {
4242 const segmentsCountKey = this . keys . buildSplitsWithSegmentCountKey ( ) ;
4343 const count = toNumber ( localStorage . getItem ( segmentsCountKey ) ) + diff ;
4444 // @ts -expect-error
@@ -128,11 +128,9 @@ export class RBSegmentsCacheInLocal implements IRBSegmentsCacheSync {
128128 const storedCount = localStorage . getItem ( this . keys . buildSplitsWithSegmentCountKey ( ) ) ;
129129 const splitsWithSegmentsCount = storedCount === null ? 0 : toNumber ( storedCount ) ;
130130
131- if ( isFiniteNumber ( splitsWithSegmentsCount ) ) {
132- return splitsWithSegmentsCount > 0 ;
133- } else {
134- return true ;
135- }
131+ return isFiniteNumber ( splitsWithSegmentsCount ) ?
132+ splitsWithSegmentsCount > 0 :
133+ true ;
136134 }
137135
138136}
Original file line number Diff line number Diff line change @@ -206,11 +206,9 @@ export class SplitsCacheInLocal extends AbstractSplitsCacheSync {
206206 const storedCount = localStorage . getItem ( this . keys . buildSplitsWithSegmentCountKey ( ) ) ;
207207 const splitsWithSegmentsCount = storedCount === null ? 0 : toNumber ( storedCount ) ;
208208
209- if ( isFiniteNumber ( splitsWithSegmentsCount ) ) {
210- return splitsWithSegmentsCount > 0 ;
211- } else {
212- return true ;
213- }
209+ return isFiniteNumber ( splitsWithSegmentsCount ) ?
210+ splitsWithSegmentsCount > 0 :
211+ true ;
214212 }
215213
216214 /**
You can’t perform that action at this time.
0 commit comments