I'm using growthbook react to get the value of a t...
# ask-questions
j
I'm using growthbook react to get the value of a tag
new_global_navigation
. It's unexpected to see a flag value is not resolved even when growthbook.ready is true: I tried to debounce the ready value as a workaround, but it's not totally fixed. Is there any way to determine flags are resolved?
f
what do you mean debounce?
j
@fresh-football-47124 Sorry, debounce is not related to the question actually. My question is how to tell the flags are resolved.
Copy code
const growthbook = useGrowthBook();

const ready = !!growthbook?.ready;

const isNewGlobalNavigationOn = useFeatureIsOn('new_global_navigation');
As the above screenshot shows, when the feature flag is open and forced to be true, the resolved flag value
isNewGlobalNavigationOn
could be false for several render cycles when
ready
becomes true.
w
Wrapping your component in <FeaturesReady> is the standard way to do this: https://docs.growthbook.io/lib/react#waiting-for-features-to-load.
That said, the value shouldn't really be changing after .ready is true. Is it possible that you are setting some attribute somewhere that the feature flag relies on - and that is happening at a later point in time?
j
Looks like it's the same as growthbook.ready.
Let me check the setAttributes
w
Yes, like I said both should work.