Skip to content

Commit

Permalink
revert: retrieval & use of current user context
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Chu committed Mar 27, 2024
1 parent ae88a38 commit 1c1c501
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const REACT_SDK_CLIENT_ENGINE = 'react-sdk';
const REACT_SDK_CLIENT_VERSION = '3.0.1';

export const DefaultUser: UserInfo = {
id: null, // null signals JS SDK to try to use VUID
id: null,
attributes: {},
};

Expand Down Expand Up @@ -351,11 +351,10 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
}

public async setUser(userInfo: UserInfo): Promise<void> {
// The JS SDK will try to assign VUID if the user ID is null
this.setCurrentUserContext(userInfo);

this.user = {
id: userInfo.id || this.getUserContext()?.getUserId() || DefaultUser.id,
id: userInfo.id || DefaultUser.id,
attributes: userInfo.attributes || DefaultUser.attributes,
};

Expand Down

0 comments on commit 1c1c501

Please sign in to comment.