File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -238,9 +238,6 @@ class FeatureToggles {
238238 if ( this . __config [ featureKey ] ) {
239239 switch ( mergeConflictBehavior ) {
240240 case CONFIG_MERGE_CONFLICT . OVERRIDE : {
241- // TODO: you cannot just remove all validations, because registering validations before init is recommended
242- // for programmatic validation
243- this . removeAllFeatureValueValidation ( featureKey ) ;
244241 break ;
245242 }
246243 case CONFIG_MERGE_CONFLICT . PRESERVE : {
@@ -313,7 +310,6 @@ class FeatureToggles {
313310
314311 if ( validations ) {
315312 this . __config [ featureKey ] [ CONFIG_KEY . VALIDATIONS ] = validations ;
316- this . _processValidations ( featureKey , validations , sourceFilepath ) ;
317313 }
318314 }
319315
@@ -337,7 +333,15 @@ class FeatureToggles {
337333 configRuntime
338334 ) ;
339335
336+ // NOTE: this post-processing is easier to do after the config is merged
340337 this . __featureKeys = Object . keys ( this . __fallbackValues ) ;
338+ for ( const featureKey of this . __featureKeys ) {
339+ const validations = this . __config [ featureKey ] [ CONFIG_KEY . VALIDATIONS ] ;
340+ if ( validations ) {
341+ const sourceFilepath = this . __config [ featureKey ] [ CONFIG_KEY . SOURCE_FILEPATH ] ;
342+ this . _processValidations ( featureKey , validations , sourceFilepath ) ;
343+ }
344+ }
341345
342346 this . __isConfigProcessed = true ;
343347 return {
You can’t perform that action at this time.
0 commit comments