fix(remote-config, ios): ensure fetchActivate() match fetch() + activate() behavior#9095
fix(remote-config, ios): ensure fetchActivate() match fetch() + activate() behavior#9095russellwheatley wants to merge 2 commits into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an inconsistency in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an issue on iOS where fetchAndActivate() incorrectly resolved to true even when no new remote config values were activated. The iOS implementation has been refactored to perform a fetch followed by an explicit activation, ensuring its behavior matches Android and the separate fetch() and activate() calls. Additionally, comprehensive end-to-end regression tests have been added to verify this behavior. The feedback recommends simplifying redundant RCTConvert calls in the Objective-C++ code to improve readability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9095 +/- ##
============================================
+ Coverage 58.61% 58.65% +0.04%
- Complexity 1616 1617 +1
============================================
Files 503 503
Lines 39178 39196 +18
Branches 5807 5779 -28
============================================
+ Hits 22962 22987 +25
Misses 14811 14811
+ Partials 1405 1398 -7
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Description
On iOS,
remoteConfig().fetchAndActivate()always resolvedtrue, even when nothing new was fetched/activated. This is inconsistent with a separatefetch()+activate()call, and inconsistent with Android'sfetchAndActivate(), which correctly resolvesfalsewhen there's nothing new.Root cause: the iOS implementation used the Firebase iOS SDK's
-[FIRRemoteConfig fetchAndActivateWithCompletionHandler:]and mapped itsFIRRemoteConfigFetchAndActivateStatusresult to a boolean (SuccessFetchedFromRemote→true, else →false). That status only reflects whether the fetch succeeded — it ignores thechangedBOOL returned by the SDK's ownactivateWithCompletion:, which is the actual "did activation change anything" signal. SinceactivateWithCompletion:essentially never errors in modern SDK versions, the status was almost alwaysSuccessFetchedFromRemote, so RNFB always resolvedtrue.Fix:
fetchAndActivate:inRNFBConfigModule.mmnow performs the fetch + activate itself (mirroring what the SDK does internally) and resolves with thechangedBOOL fromactivateWithCompletion:, using the same "already activated" error-handling special case already present in RNFB's ownactivate:method. This matches Android's semantics and iOS's ownactivate()semantics.Related issues
fixes #7779
Release Summary
fix(remote-config, ios):
fetchAndActivate()now correctly resolvesfalsewhen there is nothing new to activate, matching Android and matchingfetch()+activate().Test Plan
Added 3 new e2e tests to
packages/remote-config/e2e/config.e2e.js(in the existingfetchAndActivate()describe block), designed as regression tests that would have failed against the old iOS behavior:returns false when there is nothing new to activate— callsfetchAndActivate()twice in a row with no server-side template change; second call must resolvefalse.is consistent with fetch() followed by activate()— assertsfetchAndActivate()agrees with a separatefetchConfig()+activate()call when nothing changed.returns true only once new remote values have actually been fetched and activated— publishes a new remote config parameter via the existing cloud-function test helper (FirebaseHelpers.updateRemoteConfigTemplate/testFunctionRemoteConfigUpdateV2), then pollsfetchAndActivate()for up to 60s (template publish → fetch-backend propagation isn't instant) asserting it eventually returnstrueand the new value is visible viagetValue(). Cleans up the published parameter afterwards.Checklist
Android(unchanged, regression-tested for parity)iOSOther(macOS, web — validates test logic against firebase-js-sdk)e2etests added or updated inpackages/**/e2ejesttests added or updated inpackages/**/__tests__Think
react-native-firebaseis great? Please consider supporting the project with any of the below:React Native FirebaseandInvertaseon Twitter