Skip to content

[FSSDK-11101] refactor handling of no config availability #998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

raju-opti
Copy link
Contributor

Summary

Test plan

  • all existing tests should pass

Issues

  • FSSDK-11101

@coveralls
Copy link

coveralls commented Jan 30, 2025

Coverage Status

coverage: 82.037% (+0.2%) from 81.83%
when pulling 534177b on raju/no_config
into 25e81e2 on master.

Copy link
Contributor

@junaed-optimizely junaed-optimizely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just few suggestions

@@ -394,20 +389,16 @@ export default class Optimizely implements Client {
return;
}

if (!this.isValidInstance()) {
this.logger?.error(INVALID_OBJECT, 'track');
const configObj = this.projectConfigManager.getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -453,8 +444,9 @@ export default class Optimizely implements Client {
*/
getVariation(experimentKey: string, userId: string, attributes?: UserAttributes): string | null {
try {
if (!this.isValidInstance()) {
this.logger?.error(INVALID_OBJECT, 'getVariation');
const configObj = this.projectConfigManager.getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -624,20 +611,16 @@ export default class Optimizely implements Client {
*/
isFeatureEnabled(featureKey: string, userId: string, attributes?: UserAttributes): boolean {
try {
if (!this.isValidInstance()) {
this.logger?.error(INVALID_OBJECT, 'isFeatureEnabled');
const configObj = this.projectConfigManager.getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


if (!this.validateInputs({ user_id: userId })) {
const configObj = this.projectConfigManager.getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

this.logger?.error(INVALID_OBJECT, 'getAllFeatureVariables');
return null;
}
const configObj = this.projectConfigManager.getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

const decisionMap: { [key: string]: OptimizelyDecision } = {};
if (!this.isValidInstance() || !configObj) {
this.logger?.error(INVALID_OBJECT, 'decideAll');
const configObj = this.projectConfigManager.getConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@raju-opti raju-opti merged commit bc49e3c into master Feb 3, 2025
16 of 20 checks passed
@raju-opti raju-opti deleted the raju/no_config branch February 3, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants