Meteor-Community-Packages / meteor-collection-hooks

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

.after.update modifier #97

Closed mpranjic closed 9 years ago

mpranjic commented 9 years ago

Hi,

I am trying to detect password change with Meteor.users.after.update and modifier is undefined, unlike with .before.update where modifier is correct.

matb33 commented 9 years ago

Strange... Can you confirm with a small reproduction scenario that I could run?

ThaumRystra commented 9 years ago

Just ran into this as well. Can't produce a reproduction though, just one project has undefined modifiers for every after.update hook. The keys exist and are correct, and all the other arguments are defined correctly.

Removing this default option fixed it CollectionHooks.defaults.all.all = {fetchPrevious: false};

miri-am commented 9 years ago

can confirm. Modifier is always undefined when fetchPrevious is set to false in an after.update hook. Maybe this should be included in documentation?

adamwong246 commented 9 years ago

+1

evolross commented 9 years ago

I just ran into this too. Seems like a bug. According to the documentation setting fetchPrevious: false stops this.previous from returning which is fine. I don't need access this.previous in my hook but I still need to know what modifier has in it.

+1

matb33 commented 9 years ago

Thanks for the fetchPrevious hint -- made it much easier to track down and fix. I've deployed the fix in 0.7.14.