-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support client-only tasks globally, and per-story. #40
Support client-only tasks globally, and per-story. #40
Conversation
Hooray! All contributors have signed the CLA. |
e6b8516
to
7a8350c
Compare
Brilliant! |
Im thinking out loud here: Could we change it from |
That way, if somebody only wanted server, they could do that too. It would also mean if we have new groups in the future, we wouldn't need to change the API |
@alexreardon That sounds good. I actually started out that way and then thought I was overengineering 😆 I'll give it another go tomorrow (I'm ET timezone) and push a new commit with the changes. Thanks! |
given that it is an allow list, perhaps it should be called |
713a1aa
to
05c4567
Compare
@alexreardon Hey again. I've pushed a commit which changes One thing I had to change to fix a bug, which was present in my initial commit, is the
An error occurs because, as far as I could tell, As a "fix", I've changed the function to return I'm still missing documentation and I'm more than happy to address that in another commit to this PR. 😄 |
05c4567
to
d8e0c14
Compare
export default function getElement( | ||
getNode: () => React.ReactNode, | ||
): () => React.ReactElement { | ||
export default function getElement(getNode: () => React.ReactNode): () => React.ReactElement { |
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 change was from running prettier on the project.
This would be cool to see! Can we help push it along? |
914a99b
to
bbb2145
Compare
@alexreardon thanks for checking in with me. I've made the changes you've requested. Let me know if there's anything else I can do to help get this merged. EDIT I took a crack at adding documentation. I've added a separate commit (d36f31c) that includes it in the README. |
This is looking great! Thanks heaps for your contribution |
For projects that don't server render their components, the server-related data is not helpful. Clients can opt-in to client-only performance tests by adding: import { addParameters } from '@storybook/client-api'; addParameters({ performance: { clientOnly: true, }, }); to their .storybook/preview.js file. On a per-story basis, the `clientOnly` parameter can be set alongside the `interactions` parameter: select.story = { name: 'React select', parameters: { performance: { interactions: interactionTasks, clientOnly: true, }, }, }; This change removes all service-sid tasks, as well as the "hydrate" task in from the client-side tasks.
Removes the `defaultAllowedGroups` from the Storybook configuration to reduce confusion. This default is applied automatically, anyways.
These functions were made equivalent after the change to support a nullable result. We don't need to keep both functions.
9263b49
to
d766fbd
Compare
@alexreardon I've resolved all merge conflicts and I'm up-to-date with the I'm not sure how you want to handle changelogs/version bumps but I'm happy to take a crack at it if you like. Thanks again for all your help. |
We're not server-side rendering components and I suspect that this is triggering exceptions when the storybook-addon-performance tries to run server tasks. Luckily there is a workaround, introduced in atlassian-labs/storybook-addon-performance#40. chore/storybook-performance-addon
We're not server-side rendering components and I suspect that this is triggering exceptions when the storybook-addon-performance tries to run server tasks. Luckily there is a workaround, introduced in atlassian-labs/storybook-addon-performance#40. chore/storybook-performance-addon diff --git a/.storybook/preview.js b/.storybook/preview.js index c05206c8..c47272ba 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -79,6 +79,12 @@ const withTrackingAction = (Story) => ( </TrackingRoot> ); +addParameters({ + performance: { + allowedGroups: ['client'], + }, +}); + export const decorators = [ withThemeProvider, // withStoryStyles, chore/storybook-performance-addon chore/storybook-performance-addon
* chore: add performance addon to Storybook This will enable tracking basic performance metrics when working on Circuit components. See: https://github.com/atlassian-labs/storybook-addon-performance chore/storybook-performance-addon * test(components): measure popover interaction performance with storybook-addon-performance chore/storybook-performance-addon * fix: disable SSR performance checks We're not server-side rendering components and I suspect that this is triggering exceptions when the storybook-addon-performance tries to run server tasks. Luckily there is a workaround, introduced in atlassian-labs/storybook-addon-performance#40. chore/storybook-performance-addon * test(components): measure checkbox interaction performance We're not server-side rendering components and I suspect that this is triggering exceptions when the storybook-addon-performance tries to run server tasks. Luckily there is a workaround, introduced in atlassian-labs/storybook-addon-performance#40. chore/storybook-performance-addon * fix: run SSR tasks in development builds chore/storybook-performance-addon * fix: use document.querySelector and userEvent 1. document.querySelector should be used to select elements in interaction tasks, because getBy* breaks when using the storybook-addon-performance with several copies (it throws an exception if several elements match). getAllBy* also doesn't work because it returns an array of elements. The addon's docs use querySelector for this so we'll do the same 2. we will use userEvent instead of fireEvent chore/storybook-performance-addon * fix: remove findByText timeout It will time out after a default 1s, this is long enough for this component. chore/storybook-performance-addon
Overview
For projects that don't server render their components, the server-related data is not helpful.
Clients can opt-in to client-only performance tests by adding:
to their
.storybook/preview.js
file.On a per-story basis, the
allowedGroups
parameter can be set alongsidethe
interactions
parameter:This change removes all service-side tasks, as well as the "hydrate"
task in from the client-side group.
Screenshots
Before
After
Documentation
I'm not sure how the maintainers want this functionality documented. The easiest place would be a small section in the
README
. There is also anexamples
directory that may be a good place to add a small example. Let me know 😄