-
Notifications
You must be signed in to change notification settings - Fork 94
notify observers about changes rooting from an identify call
#256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notify observers about changes rooting from an identify call
#256
Conversation
when setting the user via `identify`, any observers were not notified about flag changes, although the underlying store changed. Fix that by calling into the notify machinery when swapping out the underlying data.
|
👋 Hey there - we just realised that calling identify did not call the feature-flag changed observers. I'm not sure this is by design or was an oversight. If this is by design - is there any other way to be notified of changes? |
|
I’ve just run into this problem - we have an observer that runs for the duration of an app session and an account switch feature that triggers a call to identify - the observer does not detect changes when calling identify. The observer is still working though and will pick up a change if I toggle a flag on and off. We are using streaming mode - I wonder if this problem also affects polling mode. |
|
For anyone interested in a workaround while this PR is open, I have taken advantage of the fact that the client is taken offline temporarily whenever you call |
|
@gwhelanLD, @louis-launchdarkly — sorry for the @, but any chance we could get some eyes on this when y’all get a moment? 🙏🏽 |
|
Hello @diederich, @lukeredpath, @jasdev Apologize and thank you for reaching out, for looking at this, and for waiting. @gwhelanLD and I had discussed this, and here are a few thoughts:
Filed internally as 128729 |
…changes Pulls in upstream 5.4.4 and 5.4.5.
Recipe: Sync'd the repo:   Then merge into our feature branch with: ``` git clone git@github.com:thebrowsercompany/ios-client-sdk.git cd ios-client-sdk git checkout -b feature/notify-observers-on-identifyUser-flag-changes origin/feature/notify-observers-on-identifyUser-flag-changes git merge v5 git push -n origin HEAD:ami/notify-observers-on-identifyUser-flag-change git push origin HEAD:ami/notify-observers-on-identifyUser-flag-change ``` Then manually updated the destination repo & branch in GitHub's "Open a pull request" page. Note for future travelers: an alternative to syncing the entire repo from upstream using the webapp above is to: ``` git add remote upstream git@github.com:launchdarkly/ios-client-sdk.git git fetch --all git checkout -b feature/notify-observers-on-identifyUser-flag-changes origin/feature/notify-observers-on-identifyUser-flag-changes git merge upstream/v5 ```
|
@louis-launchdarkly any update on this / internal 128729 ? |
We have discussed and agreed to modify the logic to not include the version as the context key generation. We will release this as a bug fix to make sure customers don't stuck on a version with old logic available.
|
Hey @louis-launchdarkly any chance we can get this merged? We'd love to delete our internal fork and use the main LD library, happy to help out here in any way, just let me know :D |
|
Hello @brianmichel, I am really sorry for the late reply. We are currently doing an audit of all the Client-side SDKs from LaunchDarkly, and are trying to line up the behavior of each SDK with this request in mind. That will inform can we merge this or adopt the change in the new callback design. |
|
Just wanted to chime in here and say that we also have issues with this and have been debugging what is going on this week. In the end we implemented a patch in our middle layer code that triggers all observers when we update the context. If the LDClient got all the updated flags internally when changing context... shouldn't the observers also be notified? |
|
@louis-launchdarkly @gwhelanLD any updates here? |
|
Actually, it looks like this is resolved in the latest v9 commits? ios-client-sdk/LaunchDarkly/LaunchDarkly/LDClient.swift Lines 307 to 312 in 0fedd19
|
|
Hello @patriknyblad and @brianmichel, sorry for the late reply to this issue. From the investigation, this is missed from the iOS and not some intentional behavior, and this was fixed in both https://github.com/launchdarkly/ios-client-sdk/releases/tag/8.3.1 and https://github.com/launchdarkly/ios-client-sdk/releases/tag/9.2.1 Can you please verify that this fixed your issue? |
@louis-launchdarkly I don't think this is fixed exactly, see #331 that I just filed |
|
@louis-launchdarkly We have been able to remove our local fix after updating the SDK. We were in contact with LD support directly and the issue is fixed for us 🙏 |
|
Closing this PR as the fix from a previous commit seems to have done the trick for everyone. |
When setting the user via
identify, any observers were not notified about flag changes, although the underlying store changed.This PR fixes that by calling into the "notify machinery" when swapping out the underlying data.
Requirements