in packages/sdk/src/Confidence.ts [223:248]
protected resolveFlags(): AccessiblePromise<void> {
const context = this.getContext();
if (!this.pendingFlags || !Value.equal(this.pendingFlags.context, context)) {
this.pendingFlags?.abort();
this.pendingFlags = this.config.flagResolverClient
.resolve(context, [])
.then(resolution => {
this.currentFlags = resolution;
})
.catch(e => {
// TODO fix sloppy handling of error
if (e.name !== 'AbortError') {
this.config.logger.info?.('Resolve failed.', e);
}
})
.finally(() => {
// if this resolves synchronously, the assignment on 171 will actually happen after we clear it.
this.pendingFlags = undefined;
});
}
if (this.pendingFlags.state !== 'PENDING') {
this.pendingFlags = undefined;
return AccessiblePromise.resolve();
}
return this.pendingFlags;
}