Subscribe on changes!

Suspense incorrectly warns that it supports single root node only

avatar
Jun 28th 2021

Version

3.1.2

Reproduction link

https://codesandbox.io/s/agitated-saha-hu5uf?file=/src/App.vue

Steps to reproduce

The linked repro is a very basic router suspense component:is setup, like so:

  <router-view v-slot="{ Component }">
    <suspense>
      <component :is="Component" />
    </suspense>
  </router-view>

Look at the CodeSandbox console.

What is expected?

No warning.

What is actually happening?

It warns "<Suspense> slots expect a single root node."


I have debugged into filterSingleRoot(children).

It seems the children array (after slot invocation) contains a single item representing <Component :is> (that's expected). For a reason unknown to me, at this point this vnode is a comment; and comments other than v-if are ignored by filterSingleRoot.

avatar
Jun 29th 2021

Sorry I did not find the duplicate (#3692 is a PR not an issue). Glad it's already fixed!

avatar
Aug 27th 2021

why close this issue, I see it happens still