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

Core: Fix ability to use component-level play functions #17817

Merged
merged 5 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion code/lib/preview-api/src/modules/store/csf/prepareStory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ export function prepareStory<TRenderer extends Renderer>(

return decoratedStoryFn(finalContext);
};
const { play } = storyAnnotations;

const play = storyAnnotations.play || componentAnnotations.play;

const playFunction =
play &&
(async (storyContext: StoryContext<TRenderer>) => {
Expand Down
6 changes: 3 additions & 3 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"version": "7.0.0-alpha.16",
"private": true,
"scripts": {
"docs:prettier:check": "cd ../docs && prettier --check ./snippets",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this change happened in the PR but I guess it makes sense, with the scripts being ordered alphabetically

"docs:prettier:write": "cd ../docs && prettier --write ./snippets",
"get-report-message": "ts-node ./get-report-message.ts",
"get-template": "ts-node ./get-template.ts",
"lint": "yarn lint:js && yarn lint:md",
"lint:js": "yarn lint:js:cmd . --quiet",
"lint:js:cmd": "cross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives",
"lint:package": "sort-package-json",
"task": "ts-node ./task.ts",
"test": "jest --config ./jest.config.js",
"docs:prettier:write": "cd ../docs && prettier --write ./snippets",
"docs:prettier:check": "cd ../docs && prettier --check ./snippets"
"test": "jest --config ./jest.config.js"
},
"husky": {
"hooks": {
Expand Down