Using the Firebase API to read data from the database gives me an awkward moment of things just suddenly coming to place 1-2 seconds after web UI has loaded. Does anyone have any alternatives to reading data? I've tried REST API, but i still need to use the Firebase authlistener, which again gives me a delay before i can retrieve user id and use the REST API. It doesn't matter how small the data I'm reading is.
I would appreciate anything over a loading screen!
below is a simple example to fetch the user status on firebase
You don't have to wait for this promise to be settled to open subscription. However depending of your app's settings your database cannot be read if you are not authenticated.
So a solution can be pretty straighforward.
With a little bit of refactor we have :
This last promise will effectively be resolved as soon as the user is auth once if and only if everything went ok. You can open the subscription before authenticating the user but it is not guarenteed to go faster. The only way to beat it is by simply removing the reading rights needed to access the db in the first place...