Describe the bug
On LaunchDarkly I have two variations and two targeting rules
First one : If buildNumber >=1 serve Variation 1
Second one: Serve Variation 2
In our codebase we configure the user with all needed properties and we add the additional custom field buildNumber set to 1. Then call allFlags() on that client after having identified the user. I receive the Variation 1. (Note that I get the same result with using jsonVariation()
If I change the buildNumber to -1 and use identify, reuse the client and then call allFlags() I still get the variation 1.
But if I force close the app and a new initialization of the client is done, then I receive variation 2.
To reproduce
Setup two variations/targeting as described above.
const defaultLDOptions = {
useReport: true,
stream: false,
disableBackgroundUpdating: true,
mobileKey,
};
const ldClient = new LDClient();
const ldUser = {
...requiredLDUserProps,
custom: {
buildNumber: 1,
},
};
await ldClient.configure(defaultLDOptions, ldUser);
const flags = await ldClient.allFlags();
console.log(flags); //Variation 1
await ldClient.identify({ ...ldUser, custom: { buildNumber: -1 } });
const flagsRound2 = await ldClient.allFlags();
console.log(flagsRound2); //Variation 1 but should be Variation 2
Expected behavior
Flags are updated appropriately returned when reidentifying the user with different values after a config.
Upon writing this issue I also fixed my problem by identifying the user right after the config with said user. It seems weird doing the config and identify with the same user, feels like making the call twice. Maybe it should be more explicit in the documentation in that case if it is expected to get appropriate results.
SDK version
3.2.1
Language version, developer tools
ReactNative 0.63.3
OS/platform
Android maybe iOS too, not tested.