Meteor-Community-Packages / meteor-collection-hooks

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

before.findOne() returns false to caller when hook is interrupted #235

Closed leite08 closed 6 years ago

leite08 commented 6 years ago

According to the documentation (below) I'm returning false from before.findOne() expecting it would interrupt the hook and return 'undefined' to the caller.

"Returning false in any before hook will prevent the underlying method (and subsequent after hooks) from executing"

Unfortunately it is actually returning false to the caller.

Looking at the source code I found that it returns no value, as one would expect:

https://github.com/matb33/meteor-collection-hooks/blob/master/findone.js#L21

But, when I debugged our unit tests, I looked at collection-hooks' source code and the same line is returning false.

We are running on version 0.8.4.

Shouldn't it return no value?

Thanks for making and keeping this project open source! :+1:

zimme commented 6 years ago

The code in master represents 0.9.0-rc.4. meteor add matb33:collection-hooks@=0.9.0-rc.4

There are breaking changes, subtle but they're there.

zimme commented 6 years ago

This commit (https://github.com/matb33/meteor-collection-hooks/commit/4783e442389e8e5b04f9ced08d204064eee1e39a) fixed this problem.

leite08 commented 6 years ago

Thanks @zimme :+1: