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

Can't override a component to mock the component due to directory path. #642

Open
CraigDaveyHornby opened this issue Jun 13, 2024 · 1 comment
Labels
status: blocked Blocked by an issue / missing feature of a dependency, or by another issue status: help wanted Good idea, but the core developers will not work on it at the moment type: enhancement New feature or request

Comments

@CraigDaveyHornby
Copy link

CraigDaveyHornby commented Jun 13, 2024

When using storybook with vue only the following code worked.

import { NuxtIcon } from './mock-components/NuxtIcon'

setup((app) => {
  app.component('nuxt-icon', NuxtIcon)
  app.component('nuxtIcon', NuxtIcon)
})

Now using storybook with nuxt this no longer works.

When loading the nuxt-icon component into a story its picks up the global one used on the site not the one in the mock-components directory

Can anyone help.

@tobiasdiez tobiasdiez added the type: enhancement New feature or request label Jun 15, 2024
@tobiasdiez
Copy link
Collaborator

I think this needs changes upstream. Currently, storybook executes preview scripts in parallel, so there is no way to ensure that user-provided preview modifications are executed after the one provided by the nuxt module.

Perhaps changing https://github.com/storybookjs/storybook/blob/e49310d82ec8c653db977917c7c9c6442c93be27/code/renderers/vue3/src/render.ts#L31 to a simple for-loop would be enough. But I don't have the time to test this currently.

@tobiasdiez tobiasdiez added status: blocked Blocked by an issue / missing feature of a dependency, or by another issue status: help wanted Good idea, but the core developers will not work on it at the moment labels Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked Blocked by an issue / missing feature of a dependency, or by another issue status: help wanted Good idea, but the core developers will not work on it at the moment type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants