-
Notifications
You must be signed in to change notification settings - Fork 83
[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
Conversation
There was a problem hiding this 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
lib/optimizely/index.ts
Outdated
@@ -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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
lib/optimizely/index.ts
Outdated
@@ -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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
lib/optimizely/index.ts
Outdated
@@ -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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
lib/optimizely/index.ts
Outdated
|
||
if (!this.validateInputs({ user_id: userId })) { | ||
const configObj = this.projectConfigManager.getConfig(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
lib/optimizely/index.ts
Outdated
this.logger?.error(INVALID_OBJECT, 'getAllFeatureVariables'); | ||
return null; | ||
} | ||
const configObj = this.projectConfigManager.getConfig(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
lib/optimizely/index.ts
Outdated
const decisionMap: { [key: string]: OptimizelyDecision } = {}; | ||
if (!this.isValidInstance() || !configObj) { | ||
this.logger?.error(INVALID_OBJECT, 'decideAll'); | ||
const configObj = this.projectConfigManager.getConfig(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
b5487ee
to
534177b
Compare
Summary
Test plan
Issues