Skip to content

Commit 973cbf7

Browse files
authored
[FSSDK-10867] ensure odpManager.setVuid is done before resolving onReady (#956)
1 parent 8feb1c0 commit 973cbf7

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/core/odp/odp_manager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ export abstract class OdpManager implements IOdpManager {
258258
return;
259259
}
260260

261+
if (!vuid && this.vuid) {
262+
vuid = this.vuid;
263+
}
264+
261265
this.eventManager.identifyUser(userId, vuid);
262266
}
263267

lib/optimizely/index.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,28 +181,26 @@ export default class Optimizely implements Client {
181181
this.eventProcessor = config.eventProcessor;
182182

183183
const eventProcessorStartedPromise = this.eventProcessor.start();
184-
184+
185185
this.readyPromise = Promise.all([
186186
projectConfigManagerReadyPromise,
187187
eventProcessorStartedPromise,
188188
config.odpManager ? config.odpManager.onReady() : Promise.resolve(),
189189
config.vuidManager ? config.vuidManager.configure(this.vuidOptions ?? { enableVuid: false }) : Promise.resolve(),
190190
]).then(promiseResults => {
191-
// Only return status from project config promise because event processor promise does not return any status.
192-
return promiseResults[0];
193-
});
194-
195-
this.readyTimeouts = {};
196-
this.nextReadyTimeoutId = 0;
197-
198-
this.onReady().then(({ success }) => {
199-
if (success) {
191+
// Only return status from project config promise because event processor promise does not return any status.
192+
const result = promiseResults[0];
193+
if (result.success) {
200194
const vuid = this.vuidManager?.vuid;
201195
if (vuid) {
202196
this.odpManager?.setVuid(vuid);
203197
}
204198
}
199+
return result;
205200
});
201+
202+
this.readyTimeouts = {};
203+
this.nextReadyTimeoutId = 0;
206204
}
207205

208206
/**

0 commit comments

Comments
 (0)