Skip to content

🔥 [🐛] Firebase Android SDK's listener view-diff engine is broken on Android #8990

@bo-rik

Description

@bo-rik

Issue

The Firebase Android SDK's listener view-diff engine is broken. Specifically, in @react-native-firebase/firestore v23.8.8 with Firebase BoM 34.10.0 (Firestore SDK 26.1.1) on Android.

It's not the network, not the gRPC stream, not auth. The bug is inside the SDK's ViewSnapshot diff logic: it compares incoming document changes against an internal view state and decides "nothing to emit." That internal state is shared across listener instances on the same query, so recycling the JS listener doesn't reset it.

It was fixed in firebase/firebase-android-sdk#7877 and released in Firebase BoM 34.11.0
As react-native-firebase currently relies on BoM 34.10.0, the only workaround is to patch the package.json; e.g.:

Create file patches/@react-native-firebase__app@24.0.0.patch:

diff --git a/package.json b/package.json
index ea88a2d23a01d189947c04e0d311d8501a3d155a..b9b8160212da6179d0d5440311efbbfa7eb3cd79 100644
--- a/package.json
+++ b/package.json
@@ -114,7 +114,7 @@
       "minSdk": 23,
       "targetSdk": 34,
       "compileSdk": 34,
-      "firebase": "34.10.0",
+      "firebase": "34.12.0",
       "firebaseCrashlyticsGradle": "3.0.6",
       "firebasePerfGradle": "2.0.2",
       "gmsGoogleServicesGradle": "4.4.4",

Add the following to pnpm-workspace.yaml

patchedDependencies:
  '@react-native-firebase/app@24.0.0': patches/@react-native-firebase__app@24.0.0.patch

Environment

  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue: 24.0.0
  • Firebase module(s) you're using that has the issue: firestore
  • Are you using TypeScript? Y

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions