Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
658 stars 90 forks source link

Extending further #240

Closed aramk closed 4 years ago

aramk commented 6 years ago

I resolved an issue I was facing with using https://github.com/Sewdn/meteor-collection-behaviours. This library uses the wrapCollection() function a second time, which in Meteor 1.6.1 leads to discarding the extended version meteor-collection-hooks applies. My changes ensure that when creating a collection, the version in meteor-collection-behaviours will call the version in meteor-collection-hooks as well.

droka commented 5 years ago

OK. So this PR is fixing two things. The first is not related to Meteor version 1.6.1, it is related to lai:collection-extensions trying to use same variable name for storing the old constructor as collection-hooks, so they conflict with each other. Anyone using both packages (collection-extensions and collection-hooks) will have the problem of hooks not running because of this. You fixed this by using a different variable in collection_hooks now. This solves the issue. (Another solution would have been using lai:collection-extensions for wrapping, as was the plan for quite some time, but it did not happen for some reason, so there is now an exact duplicate of the wrapping code in the two packages, using the same variable names -> causing the problem) The other issue that this PR is solving is to be able to call Mongo.Constructor without "new", which is a Meteor 1.6.1 related thing indeed. I'm not sure if later meteor patches fixed this already? But the first problem needs fixing badly for many of us. Can that be pulled into master? Otherwise no one can use collection-hooks together with any other package using collection-extensions at the same time.