histoire-dev / histoire

⚡ Fast and beautiful interactive component playgrounds, powered by Vite
https://histoire.dev
MIT License
3.03k stars 174 forks source link

Suspense regression: Story now accept only one child #677

Closed hugoattal closed 3 months ago

hugoattal commented 3 months ago

Describe the bug

Following https://github.com/histoire-dev/histoire/commit/26dd6ed447baa7ce002a9cb6dc86e6a79fad30e0

Vue fire a warning when there are several child nodes in a story

[Vue warn]: <Suspense> slots expect a single root node. 
  at <RenderStorySubApp>

Maybe this should be an opt-in feature? Like this: <Story suspense>...</Story>

Or wrap the inside of Suspense into a div?

Reproduction

<template>
  <Story>
    <div>Hello</div>
    <div>World</div>
  </Story>
</template>

Workaround:

<template>
  <Story>
    <div>
      <div>Hello</div>
      <div>World</div>
    </div>
  </Story>
</template>

System Info

All

Used Package Manager

pnpm

Validations

hugoattal commented 3 months ago

@Akryum I can do the fix if you want.

Two solutions:

Akryum commented 3 months ago

I'm in favor of the wrapper div