-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Bug]: Storybook 7 beta 40 crashes if preview storySort is a reference to an array #20883
Comments
Yes, the source code is here:
|
It does ERR! at async extractStoriesJson Second last error message. @ndelangen and @valentinpalkovic found out, that the implementation of storySort does not cover references to an array and only a direct array assignment which I would consider a bug that is solvable (you removed the bug label) I can live with the workaround, though :) |
@kroeder I don't see the string "Parameter 'options.storySort' should be defined inline" in your report. Regarding whether this is a bug, it's the intended behavior. We've defined the limitations of the code and give an error explaining what to do to fix it. Yes we could chase down the variable reference but where do you stop? What if it's a reference to a variable that references a variable? What if it's a variable that references an import from another file? |
// preview.js
const myOrder = ['Foo', 'Bar'];
export const parameters = {
options: {
storySort: {
method: 'alphabetical',
order: myOrder,
locales: 'en-US',
}
}
};
which is not handled by storybook/code/lib/csf-tools/src/getStorySortParameter.ts Lines 27 to 34 in 6fbc1d3
that's why throws the error unknown node type:
This change would be better:
|
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.44 containing PR #20930 that references this issue. Upgrade today to the
|
Describe the bug
In your preview.ts / js, if you previously sort stories like this
Storybook crashes with a runtime error
Workaround
Use an inline-array instead.
To Reproduce
No response
System
Additional context
No response
The text was updated successfully, but these errors were encountered: