Skip to content

Suspense incorrectly warns that it supports single root node only #4016

@jods4

Description

@jods4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions