dappsnation / akita-ng-fire

Akita ❤️ Angular 🔥 Firebase
MIT License
131 stars 27 forks source link

documention for collectionService path() seems off? #132

Closed neelz040 closed 4 years ago

neelz040 commented 4 years ago

source: https://github.com/dappsnation/akita-ng-fire/blob/v3.0.0/doc/collection/service/config.md

It seems not possible for path() to return an Observable, only string !? Thx

"akita-ng-fire": "^3.0.2",
fritzschoff commented 4 years ago

Hello, yes, you are right. Thanks for telling. Going to fix that.

neelz040 commented 4 years ago

I could use an Observable for the path() of collections. I'm using multiple agents for one app and depending on which agent is active I need different sub-collections to be sync'ed.

What would be your recommendation to do so?

fritzschoff commented 4 years ago

Not sure to understand what do you mean by agents. You could try with the path observable, (going to implement that in the next minor version) or you can work with routes. Meaning sync different collection with the CollectionGuard

neelz040 commented 4 years ago

@fritzschoff thx !! path observable will fix the 'workaround' I have now.

Agents in my case are parent collections which define a users roles etc.

fritzschoff commented 4 years ago

@GrandSchtroumpf I saw you did some error handling if the path was an observable. Did you came to a conclusion that it would be a bad idea to have an observable?

GrandSchtroumpf commented 4 years ago

Ah yes, the documentation is deprecated. I started with an observable path and it was a real pain to maintain and created a lot of unexpected side effects. I wouldn't recommend to support this. You usually want to use observable for subcollection, in this case it's better to create a helper method on syncCollection with the right options.

GrandSchtroumpf commented 4 years ago

You can find out documentation about subcollection here : https://github.com/dappsnation/akita-ng-fire/blob/v3.0.0/doc/cookbook/subcollection.md

fritzschoff commented 4 years ago

okay, I will update the docs then