Skip to content

Commit b9f7bc9

Browse files
committed
fixup: metadata check
Signed-off-by: Todd Baert <[email protected]>
1 parent 8192e1e commit b9f7bc9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

libs/providers/ofrep-web/src/lib/ofrep-web-provider.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export class OFREPWebProvider implements Provider {
129129
): ResolutionDetails<T> {
130130
return this._resolve(flagKey, 'object', defaultValue);
131131
}
132-
/* eslint-enable @typescript-eslint/no-unused-vars */
133132

134133
/**
135134
* onContextChange is called when the context changes, it will re-evaluate the flags with the new context
@@ -204,10 +203,6 @@ export class OFREPWebProvider implements Provider {
204203
const bulkSuccessResp = response.value;
205204
const newCache: FlagCache = {};
206205

207-
if ('metadata' in bulkSuccessResp && typeof bulkSuccessResp.flags === 'object') {
208-
this._flagSetMetadataCache = bulkSuccessResp.metadata || {};
209-
}
210-
211206
if ('flags' in bulkSuccessResp && typeof bulkSuccessResp.flags === 'object') {
212207
bulkSuccessResp.flags?.forEach((evalResp: EvaluationResponse) => {
213208
if (isEvaluationFailureResponse(evalResp)) {
@@ -230,6 +225,7 @@ export class OFREPWebProvider implements Provider {
230225
const listUpdatedFlags = this._getListUpdatedFlags(this._flagCache, newCache);
231226
this._flagCache = newCache;
232227
this._etag = response.httpResponse?.headers.get('etag');
228+
this._flagSetMetadataCache = typeof bulkSuccessResp.metadata === 'object' ? bulkSuccessResp.metadata : {};
233229
return { status: BulkEvaluationStatus.SUCCESS_WITH_CHANGES, flags: listUpdatedFlags };
234230
} else {
235231
throw new Error('No flags in OFREP bulk evaluation response');

0 commit comments

Comments
 (0)