CSFrequency / react-firebase-hooks

React Hooks for Firebase.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Questions about performance (bandwidth usage)

NathanC opened this issue · comments

I want to make sure I'm not using more bandwidth than I intend

If I have different components that are each using useList for firebase database, with

  • the same location (/foo/bar)
  • but different refs or a different query

Will firebase fetch the data twice, or does the backend websocket logic prevent loading the same queries/fetching the same data at once?

Thanks in advance!

@NathanC Apologies for the delay. Behind the scenes the hooks library uses the underlying Firebase library so will behave as per the documentation for Firebase. This is probably a better question to ask on the Firebase forums as I don't want to give you misinformation.

@NathanC did you have the answer ?
same use case, i need realtime profile information in multiple places but i dont know if under the hood, kind of deduplication is done

commented

@Abacaxi-Nelson No, I'm not entirely sure, have been focused on other stuff (and I've switched from realtime database -> firestore since making this issue). I would like to dig into this more later and find out for sure, but it hasn't been much of a priority.

I will say, @chrisbianca this isn't quite an upstream question, it's also a question of how this library's hooks interact with the underlying firebase SDK. i.e., if hooks from different contexts have some shared notion of underlying references, and their lifecycle in regards to the SDK. It does matter how the underlying SDK is dealing with common references and how it determines that, but it also matters how this library leverages the SDK from different contexts.