File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,11 +65,14 @@ class StatsigClient {
6565 }
6666
6767 Future updateUser (StatsigUser user) async {
68- _store.clear ();
69- _user = user.normalize (this ._options);
68+ var isSameUser = user.getCacheKey () == _user.getCacheKey ();
69+ if (! isSameUser) {
70+ _store.clear ();
71+ }
72+ _user = user.normalize (_options);
7073 StatsigMetadata .regenSessionID ();
7174
72- await _fetchInitialValues ();
75+ await _fetchInitialValues (shouldLoadCache : ! isSameUser );
7376 }
7477
7578 bool checkGate (String gateName, [bool defaultValue = false ]) {
@@ -164,8 +167,10 @@ class StatsigClient {
164167 return ;
165168 }
166169
167- Future <void > _fetchInitialValues () async {
168- await _store.load (_user);
170+ Future <void > _fetchInitialValues ({bool shouldLoadCache = true }) async {
171+ if (shouldLoadCache) {
172+ await _store.load (_user);
173+ }
169174 var res = await _network.initialize (_user, _store);
170175 if (res is Map ) {
171176 if (res["hashed_sdk_key_used" ] != null ) {
You can’t perform that action at this time.
0 commit comments