Open Rigo-m opened 2 years ago
We probably need to mock this nuxt
object? @danielroe
This is a quick mock for useState that I've internally used in some storybook projects:
import { computed, ref, reactive } from "vue"
const globalState = reactive({})
export const useState = (key, initial) => {
if (!globalState[key]) {
globalState[key] = initial()
}
const computedState = computed({
get: () => {
// force reactivity
return globalState[key]
},
set: (value) => {
globalState[key] = value
},
})
return computedState
}
Although, the problem is broader, because everything that uses some nuxt runtime (useNuxtApp alike) crashes histoire.
@Rigo-m I am also having this issue. Could you help me understand how to use the useState
mock you provided?
@agritheory you can put this mock useState file somewhere in your project and auto-import it by adding this vite plugin to histoire vite configuration
Hi @Akryum are there any plans to fix this issue or do you have any instructions for a workaround or something like that? Would be very appreciated. Thx.
Histoire using Nuxt related stuff is also an issue in #300
@danielroe @Akryum is there any thoughts/progress on this?
Any update on this issue/bug?
i also have the same problem. Any update?
@danielroe is working on stuff to simplify the nuxt integration https://twitter.com/danielcroe/status/1590490011501142017
Please give [v0.15.0] a try and report back if your issue is solved or not :pray:
@Akryum We've focused on the Vue-only part of the component library we're building with the help of Histoire and have slotted a Nuxt integration for Q3 this year. We won't be able to provide feedback on this specific issue until we pick that up again.
Please give [v0.15.0] a try and report back if your issue is solved or not 🙏
I think that is still broken, I'm not sure if I'm doing everything right. Maybe it's not related problem, but it's giving me 404 on a story with a bunch of links made with NuxtLink.
My Repository is public here: https://github.com/Archetipo95/nuxt-histoire/tree/testing-nuxt
And you can also see a deply on netlify: https://deploy-preview-11--nuxt-histoire.netlify.app/
any news?
Describe the bug
When using useState, histoire crashes
Reproduction
https://stackblitz.com/edit/nuxt-starter-szzksv?file=package.json,components%2FHello.vue,components%2FHello.story.vue
System Info
Used Package Manager
npm
Validations