-
-
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
Fix sorting of knobs Panels #6480
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-fix-addon-knobs-tab-sorting.storybook.now.sh |
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.
Thanks for fixing @benediktvaldez! Minor nitpicks above 👍
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.
@benediktvaldez code is looking great but tests are failing. can you take a look?
Let me know if you need any help, great fix btw! |
- Instead of sorting the array of groups, we now filter Other out of the array completely and append it to the end. - Also updated the story in official-storybook that displays multiple knobs groups so that the ungrouped knob is at the beginning. The previous implementation of moving the ungrouped knob panel to the end was not working as expected in Chrome. This only happened during development (running `start-storybook`) and only when the ungrouped knobs are defined before the other grouped ones. I think that is the reason this hasn’t been noticed before, since the official-storybook defined the ungrouped knobs last. I found an inconsistency in how Chrome handles `Array.prototype.sort()` compared to the other major browsers. (relevant screenshot: https://d.pr/i/S9iChT+)
f67d1d6
to
7edfeb0
Compare
So I've changed the way I'm fixing this. Part of the problem was that I was doing I also rebased the branch on Great to finally find a way to contribute @ndelangen, I have a few more minor things like this I'm hoping to look into in the next few days if I can find the time. |
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.
Looking good! ✨
Issue: The panel for ungrouped knobs would not be moved to the end as expected
What I did
Other
panel out of the array completely and append it to the end.The previous implementation of moving the ungrouped knob panel to the end was not working as expected in Chrome. I found an inconsistency in how Chrome handles
Array.prototype.sort()
compared to the other major browsers. This only happened during development (runningstart-storybook
) and only when the ungrouped knobs were defined before the grouped ones. I think that is the reason this hasn’t been noticed before, since the official-storybook defined the ungrouped knobs last.Relevant screenshot
How to test
If your answer is yes to any of these, please make sure to include it in your PR.
I'm not sure if any of these apply. I did update the story that should confirm whether this works. To replicate the error:
next
locallyexamples/official-storybook/stories/addon-knobs-stories.js
above the other ones (see diff of this PR for reference)Other
panel on that story move to the frontaddons/knobs/src/components/Panel.js
and observe the problem being fixed. *see diff of this PR for reference)