https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
j

jolly-winter-60969

09/26/2023, 4:25 AM
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

fresh-football-47124

09/26/2023, 4:26 AM
what do you mean debounce?
j

jolly-winter-60969

09/26/2023, 7:32 AM
@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

white-fireman-22476

09/26/2023, 8:33 AM
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

jolly-winter-60969

09/26/2023, 9:13 AM
Looks like it's the same as growthbook.ready.
Let me check the setAttributes
w

white-fireman-22476

09/26/2023, 9:14 AM
Yes, like I said both should work.
16 Views