growthbook / growthbook

Open Source Feature Flagging and A/B Testing Platform

Home Page:https://www.growthbook.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Multiple app session delay in reflecting the updated values of feature flag incase auto refresh is false

neha-thakur-groww opened this issue · comments

Summary

Using feature flag with auto refresh as false in react native application causes delay in reflecting the latest feature flag value by more than one app session.

Findings:
Currently I don't want to auto refresh the features in a single app session, so while initialising the sdk, I'm passing auto refresh as false and because of that no subscribedInstances are created.
The issue is that when I fetch feature, onNewFeatureData is called and it sets the newly fetched features only when you have any subscribedInstances. Since I don't have any subscribed instances, the values are not set in the same app session but only updates the cache.

function onNewFeatureData(
key: string,
cacheKey: string,
data: FeatureApiResponse
): void {
....
updatePersistentCache();

  // Update features for all subscribed GrowthBook instances
  const instances = subscribedInstances.get(key);
  instances && instances.forEach((instance) => refreshInstance(instance, data));

}

Issue:

Expected Behavior

If I change the value of a feature flag, it should be reflected on the next app launch

Current Behavior

If I change the value of a feature flag, it is reflected after 2 app launch.