Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Android - Config and identify same user with different properties on same client getAllFlag() wrong variation #60

@PaperbagWriter

Description

@PaperbagWriter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions