Skip to content

Commit

Permalink
fix(Injector): Injector component index was incorrectly placed.
Browse files Browse the repository at this point in the history
Moved the component index into the execution of the HOC result of initial Injector function call.
This allows us to preconfigure the Injector HOC in the same location as the Injectable, and promotes
less code and more reuse.
  • Loading branch information
ctrlplusb committed Apr 11, 2016
1 parent 09266c8 commit bd1e4ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ const Injector = ({ into } = {}) => {
// Error message
invalidTargetMsg);

injectorIndex++;
const injectorId = `injector_${injectorIndex}`;

return function WrapComponent(InjectionComponent) {
invariant(
InjectionComponent &&
typeof InjectionComponent === `function`,
invalidInjectMsg
);

injectorIndex++;
const injectorId = `injector_${injectorIndex}`;

class InjectorComponent extends Component {
static contextTypes = {
registerInjector: PropTypes.func.isRequired,
Expand Down

0 comments on commit bd1e4ee

Please sign in to comment.