Comments (6)
@alfonsodev I'll close this for now, let me know if you encounter this problem again.
from redux-saga-firebase.
Hi Alfonso,
Thanks for bringing this up, that's an interesting issue. :)
About firebase.database.DataSnapshot#val
Firebase's docs states that:
It may also return null, indicating that the DataSnapshot is empty (contains no data).
and for firebase.database.DataSnapshot#exists
it says:
It is slightly more efficient than using snapshot.val() !== null.
So it sounds like we should be able to call .val()
on an empty snapshot and get null
back.
Before we decide on a solution to your problem (and maybe merge your PR), I'd like to understand why this is happening.
I'll try to reproduce that on the web, I've never used RSF on RN but I don't think it would change anything (you're using the JS SDK, right?).
Could you also share your version numbers for RN, Firebase and RSF, please? 🙂
from redux-saga-firebase.
Ok so I do get null
when trying to reproduce this on the web.
Can you share the relevant RN code and confirm you're using the Firebase JS SDK? I'm genuinely curious to see how you setup Firebase + RSF in general. :)
Can you also share the error that you receive?
from redux-saga-firebase.
Thank you for taking your time for trying to reproduce the problem on the web side.
I'm using react-native-firebase
package, which is a wrapper of the native SDKs,
but they expose the same API than the web SDK.
In my case, I'm testing on iOS platform.
Looking at the code that handles snapshots on the react-native-firebase
side, it looks like
val()
should always exist and it should return null
(like the web SDK) if I'm understanding correctly the code.
So I can try to put together a small app that reproduces the issue, it might be useful also as a reference if someone wants to use this package with react-native
.
thanks!
from redux-saga-firebase.
Hi @alfonsodev,
Sorry for the long silence.
I remembered that I actually did use RSF in a demo RN project a while ago. You can find the code here: https://github.com/n6g7/cat/tree/master/rn.
The setup is pretty simple: it's RN + firebase + RSF. I'm not using any other library like react-native-firebase.
I just updated the code to the latest version of Firebase + RSF and tried to read a non-existent value and everything worked as expected:
- snapshot.exists() is false
- snapshot.val() is null
So could this be due to react-native-firebase? I haven't looked its code but I will try to do that soon.
In the meantime, could you try to find if there are any other significant differences between your app and the one I linked to?
Thanks!
from redux-saga-firebase.
Hi @alfonsodev, did you ever get round to setting up a demo app to reproduce the bug?
Otherwise I'll assume this is a bug with react-native-firebase and close this issue. :)
from redux-saga-firebase.
Related Issues (20)
- TypeScript error when using getCollection with filtered CollectionReference.
- rsf.firestore.getCollection more than 10 elements HOT 1
- Thank you
- Is this package still maintained? HOT 4
- this.app.auth is not a function HOT 1
- Examples on how to test `redux-saga-firebase`
- How to get .where working? HOT 2
- When I use `snapshot.value()` does it mean I run `value()` two times? HOT 1
- Peer dependency warning HOT 1
- Event channel stops working after react native reload
- Database.Channel typing is missing buffer argument.
- Has this been tested to work with firebase-server?
- Using RSF in react-native (messaging channel not subbed to setBackgroundMessageHandler)
- How can i access a subcollection from a colecction
- How to paginate collection
- Retrieve GeoPoint and update it
- How parse response with rsf ?
- Uncaught Error in onSnapshot: FirebaseError: Missing or insufficient permissions.
- Question: any support for batching?
- Question: Any support for http callable functions?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-saga-firebase.