Another simpler question: is there a way to check whether the features have been loaded? Something like
10/17/2023, 9:17 AM
you can await the promise
10/17/2023, 9:19 AM
Yup, that seems to be the only option for now. I wanted to avoid this since I would like to check the state in different places in the code. I looked through the code and it doesn't seem trivial to get the loading state, since a bunch of internal state would have to be exposed between the
Thanks for your response.
Was hoping for something like how Tanstack Query exposes these loading state flags.
10/17/2023, 9:20 AM
Oh, I see. I think you could handle your GB instance as a Singleton and add a property that checks if it's already loaded
And every time gb.loadFeatures() run successfully you update your local
10/17/2023, 9:21 AM
Cool, thanks, I should be able to get something like that up and running 👍
Might be useful to others: there is a
flag exposed on the growthbook instance that seems to do the same thing.