File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -525,11 +525,13 @@ export class ReflagClient {
525525 path ,
526526 this . _config . flagsFetchRetries ,
527527 ) ;
528+ const flagStateVersion = res ?. flagStateVersion ;
528529 if (
529530 ! isObject ( res ) ||
530531 ! Array . isArray ( res ?. features ) ||
531- ! Number . isInteger ( res ?. flagStateVersion ) ||
532- res . flagStateVersion < 0
532+ typeof flagStateVersion !== "number" ||
533+ ! Number . isInteger ( flagStateVersion ) ||
534+ flagStateVersion < 0
533535 ) {
534536 const fallbackDefinitions = await this . loadFlagsFallbackDefinitions ( ) ;
535537 return fallbackDefinitions
@@ -541,7 +543,7 @@ export class ReflagClient {
541543 this . canLoadFlagsFallbackProvider = false ;
542544 return {
543545 definitions : compileFlagDefinitions ( res . features ) ,
544- flagStateVersion : res . flagStateVersion ,
546+ flagStateVersion,
545547 } ;
546548 } ,
547549 {
Original file line number Diff line number Diff line change @@ -373,9 +373,10 @@ export type FlagAPIResponse = {
373373 */
374374export type FlagsAPIResponse = {
375375 /**
376- * Monotonic version of the flag state snapshot returned by the backend.
376+ * Optional for backward compatibility; when absent, the snapshot version
377+ * should be treated as unknown by consumers.
377378 */
378- flagStateVersion : number ;
379+ flagStateVersion ? : number ;
379380
380381 /**
381382 * The feature definitions.
You can’t perform that action at this time.
0 commit comments