Meteor-Community-Packages / meteor-publish-composite

Meteor.publishComposite provides a flexible way to publish a set of related documents from various collections using a reactive join
https://atmospherejs.com/reywood/publish-composite
MIT License
553 stars 58 forks source link

find and children async #160

Closed aboire closed 1 year ago

aboire commented 1 year ago

What

Add the possibility that "find" and "children" are async

Why

With Meteor async migration, there may be cases where awaiting for results is needed inside the callback.

StorytellerCZ commented 1 year ago

Published in v1.8.2

StorytellerCZ commented 1 year ago

@aboire can you please look into #167? It seem to have started happening after this. So far I have not been able to identify where exactly things get broken, so if we don't resolve this quickly I will have to reverse this PR early next week.

aboire commented 1 year ago

@StorytellerCZ Do you know how to reproduce the error? I asked for more information on the issue

StorytellerCZ commented 1 year ago

I will try to get minimum reproduction up some time. I think if you get socialize:feed package, and then on your opening page subscribe to socialize.feed.friendsPosts with data from feed posting it will throw on server.

aboire commented 1 year ago

@StorytellerCZ if you understand correctly, it is that it is no longer parallel which creates the problem because at the time of unpublish the children the entry this.documents[docId] is deleted before going through all the chidrens so I think when replacing in _publishChildrenOf "for of" by "Promise.all" that should solve the problem

nachocodoner commented 7 months ago

I believe some tests could have been added as part of this feature. Great to see this implemented though!

Forum reference: https://forums.meteor.com/t/reactive-publish-using-async-collection-functions/61470