Skip to content

Commit

Permalink
fix(injector): don't visit FunctionDeclarations more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Jul 9, 2019
1 parent 3a40065 commit 236276b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ function plugin(propTypes: t.ProgramNode, options: InjectOptions = {}): babel.Pl
needImport = true;

// Prevent visiting again
if ((node as any).hasBeenVisited) {
path.skip();
return;
}
(node as any).hasBeenVisited = true;
path.skip();

injectPropTypes({
nodeName: node.id.name,
Expand Down

0 comments on commit 236276b

Please sign in to comment.