Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Svelte stories that use a decorator show <SlotDecorator> as source #21477

Closed
tmeasday opened this issue Mar 8, 2023 · 4 comments · Fixed by #24800
Closed

[Bug]: Svelte stories that use a decorator show <SlotDecorator> as source #21477

tmeasday opened this issue Mar 8, 2023 · 4 comments · Fixed by #24800

Comments

@tmeasday
Copy link
Member

tmeasday commented Mar 8, 2023

Describe the bug

The Svelte snippet generator fails if you use a decorator.

image

To Reproduce

  1. Start a Svelte sandbox.
  2. Add a decorator
// .storybook/preview.js
import SomeDecorator from './SomeDecorator.svelte';

/** @type { import('@storybook/svelte').Preview } */
const preview = {
  parameters: {
    backgrounds: {
      default: 'light',
    },
    actions: { argTypesRegex: '^on[A-Z].*' },
    controls: {
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/,
      },
    },
  },
  decorators: [() => SomeDecorator]
};

export default preview;
// .storybook/SomeDecorator.svelte
<div>
	decorated
	<slot/>
</div>
  1. Open an autodoc and click "Show code"
  2. See that the component name is always "SlotDecorator", which is incorrect.

System

No response

Additional context

SlotDecorator is an internal component used in the Svelte renderer.

@hugohaggmark
Copy link

Hi there, any updates or plan on fixing this issue?

@hugohaggmark
Copy link

Hi @tmeasday, can I help out fixing this issue? If so can you point me in the right direction, I haven't contributed to Storybook (yet). Thank you 🙏

@tmeasday
Copy link
Member Author

@hugohaggmark sorry about the lack of response! I asked @JReinhold for his opinion and accidentally nerd sniped him into fixing it 😆 not my intention!

@hugohaggmark
Copy link

Great news @tmeasday and @JReinhold 🙌 , thank you!

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

Successfully merging a pull request may close this issue.

4 participants