Closed obulat closed 3 months ago
Visit the deploys page to approve it
Name | Link |
---|---|
Latest commit | 9c3f84baa7240c18ade7dfa39a0bde0aa3b5ac0a |
@tobiasdiez
@obulat Do you have a temporary solution to this problem?
@obulat Do you have a temporary solution to this problem?
No, unfortunately I don't.
Awesome! On a first glance it looks good to me, will do a bit more testing in a few days and then merge.
Initially, each story in my code had its own Nuxt instance because each story functioned as a separate Vue app mounted in the Storybook canvas.
That's still the case. But nuxt has now initial support for multi-app projects, so the global context didn't seem to be necessary anymore.
@obulat what exactly is the need for the global context now? Do you know if
Nuxt would get the context using the app's _name, which is the same for all stories
is by design or may be a nuxt bug?
@obulat what exactly is the need for the global context now? Do you know if
Nuxt would get the context using the app's _name, which is the same for all stories
is by design or may be a nuxt bug?
From my research globalName
was introduced in Nuxt 2 and the intention was to have it removed in Nuxt 3. globalName
is still present in Nuxt3 code, but I think it's not used for anything.
._name
was introduced in a recent PR that, as you say, @tobiasdiez, started enabling multi-app support in Nuxt: feat(nuxt): allows the support of multiple shared runtime context
By default, it is taken from '#build/nuxt.config.mjs'
:
Is it possible to set the Nuxt options' appId
when setting up the Nuxt app in the preview.ts
? Or would it be better to suggest to Nuxt to make the _name
configurable in createNuxtApp
call:
@obulat Thanks a lot for the investigation. Yesterday, I've created two PRs on the nuxt repo that should implement your findings: https://github.com/nuxt/nuxt/pull/28391 and https://github.com/nuxt/nuxt/pull/28392.
In the meantime we go with your solution, as it is clearly an improvement. I still get context issues in the "docs" section of the storybook, when multiple controls are displayed there. But single stories are working fine.
@obulat Thanks a lot for the investigation. Yesterday, I've created two PRs on the nuxt repo that should implement your findings: nuxt/nuxt#28391 and nuxt/nuxt#28392.
In the meantime we go with your solution, as it is clearly an improvement. I still get context issues in the "docs" section of the storybook, when multiple controls are displayed there. But single stories are working fine.
Thank you for all your work investigating and opening new upstream PRs, @tobiasdiez !
๐ Linked issue
Related #661
โ Type of change
๐ Description
This PR updates the global nuxt context, setting its
nuxt
property to the story's nuxt when setting up the current story.Previously, when navigating from one story to another story, Nuxt would get the context using the app's
_name
, which is the same for all stories, instead of using theglobalName
, which is different for each story.