Storybook 6.0 args don't maintain array order.
See original GitHub issueDescribe the bug When using both typescript types and argTypes, the order of args are not maintained.
To Reproduce Steps to reproduce the behavior:
- Create a component that has a prop with multiple options
- Add story with args
- See arg order is not maintained
Expected behavior Args are ordered
Screenshots
Code snippets using this as props
interface Props {
src: string;
alt: string;
size: 'smallest' | 'small' | 'medium' | 'large' | 'largest';
}
export function Example(
args: React.ComponentPropsWithoutRef<typeof UIAvatar>
): JSX.Element {
return <UIAvatar {...args} />;
}
Example.args = {
src: 'avatar.jpg',
alt: 'Avatar',
size: 'medium',
};
System:
Please paste the results of npx -p @storybook/cli@next sb info
here.
Environment Info:
System: OS: macOS 10.15.6 CPU: (12) x64 Intel® Core™ i7-8750H CPU @ 2.20GHz Binaries: Node: 12.8.1 - ~/n/bin/node Yarn: 1.22.4 - ~/.yarn/bin/yarn npm: 6.14.5 - ~/n/bin/npm Browsers: Firefox: 72.0.2 Safari: 13.1.2
Additional context I don’t know if this is possible, but I love you
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Args - Storybook - JS.ORG
“Args” are Storybook's mechanism for defining those arguments in a single JavaScript object. Args can be used to dynamically change props, slots, styles, ......
Read more >Changing args values / state in Storybook (without useState ...
A quick glance at how to change your stories args values within Storybook and ReactJs. To be combined with Storybook Controls.
Read more >Storybook 6 - how to set array of objects? - Stack Overflow
Data prop is an array of objects and I am trying to pass it like this: const data = [ object('First', {color: '#fa2dac',...
Read more >Classes and Generics - C# 6.0 Cookbook, 4th Edition [Book]
The Add method of the SortedList<K,V> class uses this interface to sort the ... The first two accept no arguments, but the last...
Read more >SugarCube v2 Documentation - Motoslave.net
If you need them, then you'll need to keep them out of story variables. ... and text arguments are accepted, the order is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shilman I looked into it more on the TypeScript side, looks like it might be planned to fix this behavior upstream, but currently no fix.
https://github.com/Microsoft/TypeScript/issues/17944
We added user-configurable sorting here:
https://github.com/storybookjs/storybook/pull/13125