Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Arrays of Hooks are running in reverse order. #13

Closed
marshallswain opened this issue Dec 26, 2014 · 3 comments · Fixed by #16
Closed

Arrays of Hooks are running in reverse order. #13

marshallswain opened this issue Dec 26, 2014 · 3 comments · Fixed by #16

Comments

@marshallswain
Copy link
Member

When setting up hooks like this:

service.before({
  find: [hooks.requireAuth, hooks.setOwner]
});

... the hooks are getting executed in reverse order, so setOwner in this case is running before requireAuth. In my opinion, they should be running in the order listed in the array.

I'm running feathers-hooks version 0.4.0 on top of feathers 1.0.0.

@marshallswain
Copy link
Member Author

#14 is a PR to fix before hooks.

@daffl
Copy link
Member

daffl commented Dec 31, 2014

I started working on a rewrite of the hooks internals that stores all hooks in an array and runs them in the order they are registered (instead of reversed as mentioned in #14). I guess this would be a breaking change but since we are still in 0.x I would think that is ok for a v0.5.

@marshallswain
Copy link
Member Author

That seems fine to me, especially if we will still be using the same syntax to register the hooks.  And it's really giving what I would consider the expected outcome for new users, anyway.  Sounds good.


Sent from Mailbox

On Wed, Dec 31, 2014 at 4:57 PM, David Luecke [email protected]
wrote:

I started working on a rewrite of the hooks internals that stores all hooks in an array and runs them in the order they are registered (instead of reversed as mentioned in #14). I guess this would be a breaking change but since we are still in 0.x I would think that is ok for a v0.5.

Reply to this email directly or view it on GitHub:
#13 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants