-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support client-only tasks globally, and per-story.
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.
- Loading branch information
1 parent
e1ea11f
commit e6b8516
Showing
13 changed files
with
79 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
import { addDecorator } from '@storybook/react'; | ||
import { addParameters } from '@storybook/client-api'; | ||
import { withPerformance } from '../src'; | ||
|
||
addParameters({ | ||
performance: { | ||
clientOnly: false, | ||
}, | ||
}); | ||
|
||
addDecorator(withPerformance); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import React from 'react'; | ||
|
||
export default function getElement( | ||
getNode: () => React.ReactNode, | ||
): () => React.ReactElement { | ||
export default function getElement(getNode: () => React.ReactNode): () => React.ReactElement { | ||
return () => <React.Fragment>{getNode()}</React.Fragment>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import serverSide from './server-side'; | ||
import initialMount from './client'; | ||
import getGroups from './client'; | ||
import { TaskGroup } from '../../types'; | ||
|
||
const preset: TaskGroup[] = [serverSide, initialMount]; | ||
|
||
export default preset; | ||
export default function getPresets({ clientOnly = false }: { clientOnly: boolean }): TaskGroup[] { | ||
const clientGroups = getGroups(clientOnly); | ||
return clientOnly ? [clientGroups] : [serverSide, clientGroups]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters