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

Listeners are called back with the name of the feature flag instead of the value #24

Closed
ClementPF opened this issue Oct 25, 2019 · 2 comments

Comments

@ClementPF
Copy link

Describe the bug

on iOS, after registering a listener with registerFeatureFlagListener, toggling the feature flag on the console calls the listener with the flag name instead of the flag value.

To reproduce
create a feature flag in the launchdarkly, for this example test-flag ON:true OFF:false

client.allFlags().then(flags => {
        Object.keys(flags).forEach(flag => {
          client.registerFeatureFlagListener(flag, value => {
            console.log(flag, value);
          });
        });
      });

toggling test-flag from on to off will print

test-flag test-flag

Expected behavior

test-flag false

SDK version
RN version : 0.61.2
launchdarkly-react-native-client-sdk : 2.0.2

OS/platform
iOS 13.1.2

Thanks !

@gwhelanLD
Copy link
Contributor

Hi @ClementPF,

Thanks for the issue report. In this case, this is the expected behavior. The application using the SDK is expected to retrieve the current value of the flag using a variation call when the flag update listener is called. Because the SDK provides the flag name, the application can use a shared listener for multiple flags.

Thanks,
-- @gwhelanLD

@ClementPF
Copy link
Author

@gwhelanLD
Okay ! The https://docs.launchdarkly.com/docs/react-native-sdk-reference is a little confusing then.

LaunchDarkly manages all flags for a user context in real-time by updating flags based on a real-time event stream. When a flag is modified via the LaunchDarkly dashboard, the flag values for the current user will update almost immediately.

Thanks for the quick response.

LaunchDarklyCI pushed a commit that referenced this issue Nov 25, 2019
* Update CHANGELOG and package.json for React Native 0.61.0

* Fix Xcode version

* Updated to React Native 0.61.1

* Fix android build by installing missing emulator dependency

* Added another missing dependency

* Testing docker image without node

* emulator troubleshooting, remove apt-get update

* Bumped to RN 0.61.2

* Bump version number and update CHANGELOG date

* Use pinned circleci android image
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants