Skip to content

Commit 88f9908

Browse files
committed
fix: Addon panel not working.
Two fixes were required. Use the correct addons import and withRoundTrip as a decorator for all stories.
1 parent cecba60 commit 88f9908

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

packages/mock-addon-docs/.storybook/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const config = {
44
'../stories/**/stories.@(js|jsx|mjs|ts|tsx)',
55
],
66
addons: [
7-
'../../mock-addon/preset.js',
7+
'../../mock-addon/src/preset/manager.js',
88
'@storybook/addon-links',
99
'@storybook/addon-essentials',
1010
'@storybook/addon-interactions',
@@ -15,6 +15,6 @@ const config = {
1515
},
1616
docs: {
1717
autodocs: 'tag',
18-
},
18+
}
1919
};
2020
export default config;

packages/mock-addon-docs/.storybook/preview.js

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {withRoundTrip} from "storybook-addon-mock/src/withRoundTrip";
2+
3+
const Preview = {
4+
parameters: {
5+
options: {
6+
storySort: {
7+
order: ['Docs', ['Introduction', 'Installation', 'User guide']],
8+
includeName: true
9+
}
10+
},
11+
mockAddonConfigs: {
12+
globalMockData: [],
13+
refreshStoryOnUpdate: true,
14+
disableUsingOriginal: false,
15+
},
16+
},
17+
decorators: [withRoundTrip],
18+
}
19+
20+
export default Preview

packages/mock-addon-docs/stories/docs/advanced-setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Footer } from './footer';
1616

1717
<h3 className="subheading">1. Global configuration</h3>
1818

19-
You can set <strong>global configuration</strong> for the addon. Go to the `.storybook/preview.js` file and add `mockAddonConfigs` fields with the following properties.
19+
You can set <strong>global configuration</strong> for the addon. Go to the `.storybook/preview.jsxx` file and add `mockAddonConfigs` fields with the following properties.
2020

2121

2222

packages/mock-addon/src/withRoundTrip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FORCE_RE_RENDER, STORY_CHANGED } from '@storybook/core-events';
22
import { EVENTS, PARAM_KEY, GLOBAL_PARAM_KEY } from './utils/constants';
33
import faker from './utils/faker';
4-
import { addons } from '@storybook/manager-api';
4+
import { addons } from '@storybook/preview-api';
55

66
const getParameter = (parameters, key, defaultValue) => {
77
return parameters[key] || defaultValue;

0 commit comments

Comments
 (0)