-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suspense should support multi-root nodes #3795
Comments
As far as I can tell, by now it's already possible to have multiple root nodes without any warning, so this could be closed? |
Documentation still mentions limit to one node:
And warning is still issued as of Vue v3.3.11. Interestingly, to it also looks like everything works? |
3 years later, I have deployed several large apps in production that wrap multi-root components with Suspense and never had any issue. BTW Suspense was a key new feature of Vue 3.0, but it's still experimental today. |
It seems not to be working. see playground core/packages/runtime-core/src/components/Suspense.ts Lines 830 to 864 in 80ba50d
|
@edison1105 That's weird. When I look at the source code that you quote, I don't see how it could work in my projects. When the warning is displayed then Yet I see the warning in console and everything still works fine in my cases. I must somehow be lucky because your example with two custom components side-by-side clearly doesn't work, indeed. I'm gonna be travelling for a while but when I come back I'll try to look for a fix. I would love to see Suspense moving forward. |
What problem does this feature solve?
Vue 3 allows components to have more than one root element.
Using such components in
<Suspense>
warns:This limits the usability of
<Suspense>
and makes async components feel more limited, "2nd-class citizens", in Vue 3.This is particularly annoying when using
<Suspense>
at the root of<router-view>
. Some CSS layouts don't work with intermediate<div>
wrappers (e.g. grids, unless you know aboutdisplay: contents
).Note that my app seems to work fine anyway, despite the warning? If it is obsolete then maybe the warning should just be removed.
What does the proposed API look like?
No new API surface.
The text was updated successfully, but these errors were encountered: