What’s the recommended approach to trigger a refet...
# ask-questions
m
What’s the recommended approach to trigger a refetch of feature toggles with GrowthBook? Let’s say a user logs in and I want to update the toggles based on some value that’s only available when the user is signed in. Would running setAttributes automatically trigger a refetch or do I need to retrigger creating my Growthbook instance? I saw something about autoRefresh, but that’s mainly for when features are added / updated in Growthbook I assume?
Copy code
await gb.loadFeatures({ autoRefresh: true });
Or would updating your attributes with setAttributes also retrigger an autorefresh in this scenario?
f
it triggers a refresh if you call setAttributes again
the autoRefresh is not for that - its for connecting to the GrowthBook Proxy server, otherwise it has no effect. We use Server-Sent Events, but only if you’re connecting through a GrowthBook Proxy server (https://docs.growthbook.io/self-host/proxy). - that’s what that setting controls - without that it has no effect. Alternatively, you can manually update at any time by calling
gb.refreshFeatures()
. So you can implement your own polling behavior if you want or hook into user actions like navigation or button clicks.