-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
fix: multiple mapped args return array of labels #22169
fix: multiple mapped args return array of labels #22169
Conversation
Co-authored-by: phunguyenmurcul <51897872+phunguyenmurcul@users.noreply.github.com>
@JReinhold Could you please review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find!
Just to summarize the issue for myself here. The problem with the current implementation, is that when there are multiple selected, the arg will be an array of the selected args. and so when we do val in mapping
it will return false, because val
will not be the actual key in the mapping, it will be a list of keys instead.
But this PR makes it so we handle it differently for arrays, and ensure that arrays of keys are mapped like a single key would be.
Would you be open to add some template stories that ensures this works? I think they would fit in here: https://github.com/storybookjs/storybook/blob/next/code/lib/store/template/stories/argTypes.stories.ts
AFAIK we don't have any stories that covers args mapping at all, so it would be great if you could add some for different use cases.
Let me know if you need more guidance on how to add and test template stories.
…thub.com/gitstart/storybook into fix/wrong-multiple-mapped-args
Co-authored-by: phunguyenmurcul <51897872+phunguyenmurcul@users.noreply.github.com>
…thub.com/gitstart/storybook into fix/wrong-multiple-mapped-args
Co-authored-by: phunguyenmurcul <51897872+phunguyenmurcul@users.noreply.github.com>
…thub.com/gitstart/storybook into fix/wrong-multiple-mapped-args
Co-authored-by: phunguyenmurcul <51897872+phunguyenmurcul@users.noreply.github.com>
@JReinhold I added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks! 💪
Core: Add tests for mapping behaviour in #22169
fix: multiple mapped args return array of labels
Issue: #22042
What I did
Fix issue of configured
mapping
+control.type=multi-select
argType component is rendered with wrong mapped arg value.How to test
sandbox/react-vite-default-ts/src/stories/Button.stories.ts
Button.tsx
with adding new proparrows
andconsole.log
it insideButton
render functionarrows
value is corrected mapped array object