[馃敟] Priority values missing from firebase realtime database DataSnapshot #7719
Labels
Help: Needs Triage
Issue needs additional investigation/triaging.
Impact: Bug
New bug report
Workflow: Needs Review
Pending feedback or review from a maintainer.
Issue
Describe your issue here
I'm switching my app from firebase web (V8) to react-native-firebase. (I figured it would be less work to refactor than going to web V9) But I have run into a problem.
I use Priority values to store a value that indicates ordering of objects in a realtime database container, and when I read the snapshot the priorities are not there. It seems like the top-level snapshot has a priority value, but when I access the child snapshots with snap.child("child1') or snap.forEach(), the child snapshots do not contain a
.priority
property.This is the code has been working in my app for over 5 years (with added debugging printouts).
When I change the order of the counters on another device, my
.on
listener triggers and I get the following printout:This shows the top-level snap contains a
.priority
value (null) but the "Counter 44" child does not have the property at all. I can verify that the other device successfully pushed the new priorities to firebase: although the firebase console does not show priorities, I can export and download the container, and it looks like this:Is this exposing a previously unknown bug in my program, is it a bug in RNFirebase, a change in underlying FB V9+ iOS/Android libraries (It has the same problem on both platforms), or ???
react-native: 0.70.15
react-native-firebase: 19.1.1
[UPDATE:] I wondered if offline persistence might have something to do with this so I enabled persistence and found the problem remains the same either way.
[NOTE:] I filed a StackOverflow question about this but since I'm pretty sure this is a bug I decided to go ahead and file an issue. The above is a copy-paste from that SO question.
I created a reproducible demo which is here.
This is the RNFB demo with just App.tsx changed to demonstrate the issue. Since the whole setup is the default, I have not included any of my own files below (Podfile, build.gradle, etc.) Note that I only tried the RNFB demo on iOS but I have confirmed the issue is the same on Android in my app.
When running my demo, you may want to edit
make-demo.sh
so it doesn't install all the RNFB modules. The only ones needed are app and database. Also, the defaultreact-native run-ios
build fails for me. I didn't investigate, I always prefer to use xcode. I just opened up xcode and ran on the simulator with no problemProject Files
Javascript
Click To Expand
package.json
:# N/A
firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:19.1.1
Firebase
module(s) you're using that has the issue:database
TypeScript
?N
&VERSION
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: