posva / vuexfire

Check
https://github.com/vuejs/vuefire
MIT License
558 stars 49 forks source link

[Question] Handle loading data #180

Closed JFGHT closed 6 years ago

JFGHT commented 6 years ago

I'm trying to build a loader/spinner but I'm not sure how'd be the best approach to detect that the data hasn't been reached yet.

With objects/docs works fine since I've got a null that becomes an object full of properties. But how should I do this with Arrays (collections)? And even more: if I change the slice of state's default initialization from empty array to null, how should I do this inside a getter method where this slice still comes as an object?

posva commented 6 years ago

I recommend you to give vue-promised a look. You can use the $bind function and save the promise in a property defined in data that you pass to the Promised component of the library mentioned above. With vuex you should return the promise in the action and use the action result in the component instead