Immutable solution version
React Native SDK leads to unexpected `on('change', ...)` calls reverting previous flag evaluations
Complete solution
Shows how to fix react Native SDK leads to unexpected `on('change', ...)` calls reverting previous flag evaluations. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "on('change', ...)": upgrade to the React Native SDK release containing the identify-queueing fix (PRs #842 and #867). Reported in LaunchDarkly: React Native SDK leads to unexpected on('change',...) calls reverting previous flag evaluations.
on('change', ...)Steps
- Upgrade to the React Native SDK release containing the identify-queueing fix (PRs #842 and #867). The root cause was overlapping identify calls producing out-of-order re-evaluations and stale change handlers; the fix queues identifies and disconnects update handlers for closed data sources. The reporter tested the fix and got the expected change events, then upgraded to the released versions and accepted the closure. Also avoid initializing multiple SDK instances on the same environment (the cache is per environment), and you can set
debug: truein the SDK options to trace identify ordering if problems persist.
When to use
Use this skill when you run into "React Native SDK leads to unexpected on('change', ...) calls reverting previous flag evaluations".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Edge cases
- Also avoid initializing multiple SDK instances on the same environment (the cache is per environment), and you can set debug: true in the SDK options to trace identify ordering if problems persist.
Evidence
In gh:launchdarkly/js-core#840 (https://github.com/launchdarkly/js-core/issues/840), the reporter ran into this: Reported in LaunchDarkly: React Native SDK leads to unexpected on('change', ...) calls reverting previous flag evaluations. The verified resolution: Upgrade to the React Native SDK release containing the identify-queueing fix (PRs #842 and #867). The root cause was overlapping identify calls producing out-of-order re-evaluations and stale change handlers; the fix queues identifies and disconnects update handlers for closed data sources. The reporter tested the fix and got the expected change events, then upgraded to the released versions and accepted the closure. Also avoid initializing multiple SDK instances on the same environment (the cache is per environment), and you can set debug: true in the SDK options to trace identify ordering if problems persist.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_fC8AEOEZyxzWLvk3YCa8rw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">React Native SDK leads to unexpected `on('change', ...)` calls reverting previous flag evaluations <span>— Vectle</span></a>