Skip to content

Commit

Permalink
config helper undefined check
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwootto committed Jul 3, 2024
1 parent fef5788 commit 2d092cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sdk/nodejs/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class DevCycleClient {
private clientUUID: string
private hostname: string
private sdkKey: string
private configHelper: EnvironmentConfigManager
private configHelper?: EnvironmentConfigManager
private clientConfigHelper?: EnvironmentConfigManager
private eventQueue: EventQueue
private onInitialized: Promise<DevCycleClient>
Expand Down Expand Up @@ -235,7 +235,7 @@ export class DevCycleClient {
)
const populatedUser = DVCPopulatedUserFromDevCycleUser(incomingUser)

if (!this.configHelper.hasConfig) {
if (!this.configHelper?.hasConfig) {
this.logger.warn(
'variable called before DevCycleClient has config, returning default value',
)
Expand Down Expand Up @@ -290,7 +290,7 @@ export class DevCycleClient {
allVariables(user: DevCycleUser): DVCVariableSet {
const incomingUser = castIncomingUser(user)

if (!this.configHelper.hasConfig) {
if (!this.configHelper?.hasConfig) {
this.logger.warn(
'allVariables called before DevCycleClient has config',
)
Expand All @@ -309,7 +309,7 @@ export class DevCycleClient {
allFeatures(user: DevCycleUser): DVCFeatureSet {
const incomingUser = castIncomingUser(user)

if (!this.configHelper.hasConfig) {
if (!this.configHelper?.hasConfig) {
this.logger.warn(
'allFeatures called before DevCycleClient has config',
)
Expand Down Expand Up @@ -435,7 +435,7 @@ export class DevCycleClient {
async close(): Promise<void> {
await this.onInitialized
await this.flushEvents()
this.configHelper.cleanup()
this.configHelper?.cleanup()
this.eventQueue.cleanup()
clearInterval(this.bucketingTracker)
}
Expand Down

0 comments on commit 2d092cb

Please sign in to comment.