Migration docs: Improved story source handling

This commit is contained in:
Michael Shilman 2020-03-10 01:01:53 +08:00
parent 4da13093ab
commit 68d1689082

View File

@ -9,6 +9,7 @@
- [Changed Parameter Handling](#changed-parameter-handling)
- [Simplified Render Context](#simplified-render-context)
- [Story Store immutable outside of configuration](#story-store-immutable-outside-of-configuration)
- [Improved story source handling](#improved-story-source-handling)
- [From version 5.2.x to 5.3.x](#from-version-52x-to-53x)
- [To main.js configuration](#to-mainjs-configuration)
- [Using main.js](#using-mainjs)
@ -249,6 +250,33 @@ The `RenderContext` that is passed to framework rendering layers in order to ren
You can no longer change the contents of the StoryStore outside of a `configure()` call. This is to ensure that any changes are properly published to the manager. If you want to add stories "out of band" you can call `store.startConfiguring()` and `store.finishConfiguring()` to ensure that your changes are published.
### Improved story source handling
The story source code handling has been improved in both `addon-storysource` and `addon-docs`.
In 5.x some users used an undocumented _internal_ API, `mdxSource` to customize source snippetization in `addon-docs`. This has been removed in 6.0.
The preferred way to customize source snippets for stories is now:
```js
export const Example = () => <Button />;
Example.story = {
parameters: {
storySource: {
source: 'custom source',
},
},
};
```
The MDX analog:
```jsx
<Story name="Example" parameters={{ storySource: { source: 'custom source' } }}>
<Button />
</Story>
```
## From version 5.2.x to 5.3.x
### To main.js configuration