Skip to content

Preserve inline CSF3 story parameters in full-source preset - #36661

Open
Dmytro Kirpa (dmytrokirpa) with Copilot wants to merge 4 commits into
masterfrom
copilot/fix-babel-preset-storybook-full-source-issue
Open

Preserve inline CSF3 story parameters in full-source preset#36661
Dmytro Kirpa (dmytrokirpa) with Copilot wants to merge 4 commits into
masterfrom
copilot/fix-babel-preset-storybook-full-source-issue

Conversation

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

babel-preset-storybook-full-source treated CSF3 stories with inline parameters as missing parameters, then appended Story.parameters = {} before assigning fullSource. This dropped existing Storybook metadata such as docs.description.story.

  • Parameter detection

    • Detects inline parameters on CSF3 object story exports.
    • Handles TS-wrapped story initializers such as as and satisfies.
  • Regression coverage

    • Adds a typed CSF3 fixture matching the reported Meta / StoryObj pattern.
    • Updates existing CSF3 fixture expectations so inline parameters are preserved.
export const Default: Story = {
  render: () => <div>Example</div>,
  parameters: {
    docs: { description: { story: 'Description' } },
  },
};

// generated augmentation now preserves Default.parameters
Default.parameters.fullSource = '...';
Copilot AI and others added 2 commits August 31, 2026 15:59
Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix babel-preset-storybook-full-source overwriting CSF3 parameters Aug 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot fix review comments

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Preserve inline CSF3 story parameters when adding fullSource",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"comment": "Preserve inline CSF3 story parameters when adding fullSource",
"comment": "fix: Preserve inline CSF3 story parameters when adding fullSource",
export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets also add a test for StoryFn with parameters if we don't have such yet:

type Story = StoryFn<typeof meta>;

export const Default: Story = () => <div>Example</div>;

Default.parameters = {
  docs: { story: {  docs: { description: { story: 'Description' } } }
}
Co-authored-by: dmytrokirpa <1492102+dmytrokirpa@users.noreply.github.com>

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Copilot fix review comments

Addressed in 4af77918: updated the Beachball comment wording and added StoryFn parameters regression coverage. Focused validation passed for test, format, type-check, lint, and secret scanning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment