Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: middleware functions added in 'beforeAction' not executing #95

Merged
merged 2 commits into from
May 19, 2016

Conversation

zacharygolba
Copy link
Contributor

This PR fixes the issue of middleware not being executed when added to the beforeAction array on a Controller.

The reason this bug exists is because #65 introduced many improvements where previously computed properties were moved to it's classes constructor in attempt to prevent multiple executions of a getter. The downside of doing this is that class properties will not be installed on the prototype until after the constructor is called. This simply moves the middleware property back to a computed getter function which is later memoized in the Route class upon the application's boot so there is no perf regression.

This PR also removes the parent class Base from Controller which is part of an ongoing refactor to no longer be using Base as a parent for packages within Lux. It doesn't provide any additional functionality since we can mimic setProps with Object.assign(this, props) and it will be better to not dirty the prototype chain moving forward unless it's absolutely necessary.

Closes #94

@zacharygolba zacharygolba force-pushed the parent-middleware-fix branch from 9bebefe to 7fea926 Compare May 18, 2016 23:42
@jhliberty
Copy link
Contributor

Reviewing the code.. can't assign myself but feel free to do it for me

@mutewinter
Copy link

looked good to me. I like the regression test

@zacharygolba zacharygolba merged commit a7e54aa into master May 19, 2016
@zacharygolba zacharygolba deleted the parent-middleware-fix branch May 19, 2016 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Middleware Added in beforeAction Not Executing
3 participants