File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,7 @@ export class FlagsClient {
289289 async initialize ( ) {
290290 if ( this . initialized ) {
291291 this . logger . error ( "flags client already initialized" ) ;
292+ return ;
292293 }
293294 this . setFetchedFlags ( ( await this . maybeFetchFlags ( ) ) || { } ) ;
294295 this . initialized = true ;
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ describe("FlagsClient", () => {
108108 expect ( testLogger . warn ) . toHaveBeenCalledTimes ( 1 ) ;
109109 vi . advanceTimersByTime ( 60 * 1000 ) ;
110110 await flagsClient . initialize ( ) ;
111- expect ( testLogger . warn ) . toHaveBeenCalledTimes ( 2 ) ;
111+ expect ( testLogger . error ) . toHaveBeenCalledTimes ( 1 ) ;
112112 } ) ;
113113
114114 test ( "ignores undefined context" , async ( ) => {
@@ -508,14 +508,14 @@ describe("FlagsClient", () => {
508508 updateTriggered = true ;
509509 } ) ;
510510
511- // Trigger the flags updated event by setting context (which should not fetch since already initialized )
511+ // Trigger the flags updated event by setting context (which should still fetch)
512512 await flagsClient . setContext ( {
513513 user : { id : "456" } ,
514514 company : { id : "789" } ,
515515 other : { eventId : "other-conference" } ,
516516 } ) ;
517517
518- expect ( updateTriggered ) . toBe ( false ) ; // No update since context change doesn't affect pre-fetched flags
518+ expect ( updateTriggered ) . toBe ( true ) ;
519519 } ) ;
520520
521521 test ( "should work with fallback flags when initialization fails" , async ( ) => {
You can’t perform that action at this time.
0 commit comments