If you're running Storybook v8 with the "autotags" to generate a MDX document of all your stories, then it uses the wrong mocks for each story.
Reference: https://storybook.js.org/docs/writing-docs/autodocs
In the following example, the autotags is used to render both the FirstStory and the SecondStory on the page, and the SecondStory will receive the mocks from FirstStory. This only happens on the autotags page, when viewing the stories individually it works fine.
export default {
title: 'Example',
component: MyExample,
tags: ['autodocs'],
// ^^^ enable autodocs feature
} satisfies Meta<typeof MyExample>;
type Story = StoryObj<typeof MyExample>;
export const FirstStory: Story = {
parameters: {
mockData: [
// *** mock some stuff
]
}
};
export const SecondStory: Story = {
parameters: {
mockData: [
// *** mock some stuff
]
}
};
If you're running Storybook v8 with the "autotags" to generate a MDX document of all your stories, then it uses the wrong mocks for each story.
Reference: https://storybook.js.org/docs/writing-docs/autodocs
In the following example, the autotags is used to render both the
FirstStoryand theSecondStoryon the page, and theSecondStorywill receive the mocks fromFirstStory. This only happens on the autotags page, when viewing the stories individually it works fine.