Ngrx, Firestore and Ionic - best practice


I am workig on an Ionic4 Angular project using NGRX and Firestore.

There is fairly enough information available about this combination, using @Effects.

One part for which I would love to hear your views on the aspect of changing data and having them synced with Firestore and ngrx Store:

Update the Firestore using Effects and then wait until the Firestore pushes the update to the ngrx Store in the app, or update the ngrx Store and the Firestore to ensure the user immediate sees the changes.

For the latter solution I wonder what the best strategy is for low bandwidth phones (slow responses). I am considering a parallel update where in the end the Firestore will overrule the ngrx Store, taking the Firestore as the single source of truth.

Is there any other option you can think of? With not too much efforts of course



Some links I visited:

I’m also stuck on this problem. It’s tricky to perfect the perfect pattern using ngrx’s actions, effects, reducers, selectors, and firestore real time database. Once I get it I’ll post my solution and hopefully help everyone else out.

I skipped efffects and use service to handle side effects like a load. And as a wrapper to all dispatch and query selectors

I thought about doing the same haha

In my mind i wanted things organized a certain way like have a store folder inside my feature module. I spent a bunch of time looking through guides, taking courses but all of them were lacking and mostly proof of concepts instead of best practices.

Luckily after enough head bashing I found a really good template and loved the pattern that they implemented.

Check it out