j.Doe
j.Doe

Reputation: 212

Firebase asynchronious data retrieval takes time

I have a web app that uses firebase's method onAuthStateChanged() to subscribe to user data. This functionality works fine and I love the subscribe functionality to get realtime updates on the data.

However, when displaying data, it always takes a while until my data is displayed - makes sense if I call the function for the first time - data has eventually to be retrieved from the firebase servers. But even when reloading the page or navigating to another component, data again takes a while to be displayed. I am using fb.data | async to subscribe to the data in my HTML components. Where fb.data is an observable returned in the onAuthStateChanged() block.

Not sure if that's just something to be prepared for when using front-end frameworks to retrieve data or if I actually am doing something wrong.

Upvotes: 1

Views: 28

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317958

A new listener is not going to be instantaneous. Even reading from local disk cache is going to have a small delay. There's not much you can do about this.

Upvotes: 2

Related Questions