Skip to content

Commit

Permalink
fix: usage of story props fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Mar 3, 2020
1 parent 7fabe82 commit 6c3516d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/instrument/src/babel/control-values-in-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ export const extractArgumentsUsage = (story: Story, args: StoryArguments) => {
});
},
JSXSpreadAttribute: (path: any) => {
if (path.node.argument === 'Identifier') {
if (path.node.argument.type === 'Identifier') {
addArgumentUsage(story, args, path.node.argument);
}
},
JSXExpressionContainer: (path: any) => {
if (path.node.expression.type === 'Identifier') {
addArgumentUsage(story, args, path.node.expression);
}
},
ArrowFunctionExpression: (path: any) => {
if (path.node.body === 'Identifier') {
if (path.node.body.type === 'Identifier') {
addArgumentUsage(story, args, path.node.body);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ Object {
},
},
"name": "props",
"usage": Array [
Object {
"loc": Object {
"end": Object {
"column": 25,
"line": 0,
},
"start": Object {
"column": 20,
"line": 0,
},
},
},
],
"value": "props",
},
],
Expand Down Expand Up @@ -483,6 +497,20 @@ Object {
},
},
"name": "props",
"usage": Array [
Object {
"loc": Object {
"end": Object {
"column": 25,
"line": 0,
},
"start": Object {
"column": 20,
"line": 0,
},
},
},
],
"value": "props",
},
],
Expand Down Expand Up @@ -576,6 +604,20 @@ Object {
},
},
"name": "props",
"usage": Array [
Object {
"loc": Object {
"end": Object {
"column": 36,
"line": 0,
},
"start": Object {
"column": 31,
"line": 0,
},
},
},
],
"value": "props",
},
Object {
Expand Down

0 comments on commit 6c3516d

Please sign in to comment.