Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 6fa9cd0

Browse files
zashraf1985mjc1283
authored andcommitted
fix: feature enabled will now only be available when experiment is feature experiment (optimizely#384)
OptimizelyConfig was using featureEnabled directly from projectConfig Object without verifying if experiment is feature experiment or not. Now featureEnabled key on variation will only be available if experiment is a feature experiment.
1 parent ee8ab9d commit 6fa9cd0

File tree

1 file changed

+4
-1
lines changed
  • packages/optimizely-sdk/lib/core/optimizely_config

1 file changed

+4
-1
lines changed

packages/optimizely-sdk/lib/core/optimizely_config/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
var projectConfig = require('../project_config');
1617

1718
// Get Experiment Ids which are part of rollouts
1819
function getRolloutExperimentIds(rollouts) {
@@ -41,9 +42,11 @@ function getExperimentsMap(configObj) {
4142
variations[variation.key] = {
4243
id: variation.id,
4344
key: variation.key,
44-
featureEnabled: variation.featureEnabled,
4545
variablesMap: getMergedVariablesMap(configObj, variation, experiment.id, featureVariablesMap)
4646
};
47+
if (projectConfig.isFeatureExperiment(configObj, experiment.id)) {
48+
variations[variation.key].featureEnabled = variation.featureEnabled;
49+
}
4750
return variations;
4851
}, {}),
4952
};

0 commit comments

Comments
 (0)