GithubHelp home page GithubHelp logo

Comments (6)

n6g7 avatar n6g7 commented on May 18, 2024 1

@alfonsodev I'll close this for now, let me know if you encounter this problem again.

from redux-saga-firebase.

n6g7 avatar n6g7 commented on May 18, 2024

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.

n6g7 avatar n6g7 commented on May 18, 2024

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.

alfonsodev avatar alfonsodev commented on May 18, 2024

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.

n6g7 avatar n6g7 commented on May 18, 2024

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.

n6g7 avatar n6g7 commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.