3.0.0
https://jsfiddle.net/ph75kLwo/
Click toggle child many times
the child to display
The child doesn't display and there is an error
I tracked down this issue. When a component with asyncDep is toggled, the component will be re-mount, which means registerDep will be called. But suspense has been resolved, and pendingBranch is null, nothing will happen according to the current implementation, so resulting in subsequent errors.
This involves some design decisions, I don鈥檛 have the ability to solve it, but I hope this information can save @yyx990803 鈥檚 time
New nested async child rendered inside an already resolved suspense no longer puts the suspense into pending state (TODO: components with async setup() should be allowed to declare its own loading state / timeout etc. just like defineAsyncComponent)
TODO inside https://github.com/vuejs/vue-next/pull/2099
Great, nice to know, thanks
In case it helps, sticking to [email protected] version under yarn.lock fixed all my issues with Suspense and router-views. You need to install dependencies with yarn --frozen-lock-file.
vue@^3.0.0-0:
version "3.0.0-rc.5"
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-rc.5.tgz#973175d45a892b3bd23ef5de7faa4add9c66275f"
integrity sha512-8t8Y4sHMBGD5iLZ7JfBGmKBJlzesPoL+/nW9EV8s+4LwnKC4rGlRp+Lj2rcign4iQaj0GFaL7DrQ8IoOfVX6+w==
dependencies:
"@vue/compiler-dom" "3.0.0-rc.5"
"@vue/runtime-dom" "3.0.0-rc.5"
"@vue/shared" "3.0.0-rc.5"
I had a few stable projects working on beta version and they suddenly stopped working... Truth is we were warned about a changing API for Suspense from the beginning.
This PR shows the changes to get a brand new vue-cli app with Suspense back to life: https://github.com/yeikiu/base-vue3-ts/pull/1/files#diff-8ee2343978836a779dc9f8d6b794c3b2L8832 maybe using the yarn.lock from develop branch there can help you temporarily...
any news about how to properly nest suspense + keep alive + component with async setup? even though the PR linked above is already merged im still getting an error unless i use the old 3.0.0-rc.5 :-(
my setup:
<router-view v-slot="{ Component }">
<Suspense>
<keep-alive>
<component :is="Component" :key="$route.path" />
</keep-alive>
</Suspense>
</router-view>
thank you for help
Got hit by this as well, I had a <Suspense> around <RouterView>.
My goal was of course to load async routes but it doesn't work anymore since the component directly inside <Suspense> must change to go back to pending state.
What would _really_ help here is to put a warning in dev mode when this happens, right here:
https://github.com/vuejs/vue-next/blob/0227b4a697afd598f6fa279a1a7ce84242e68f43/packages/runtime-core/src/components/Suspense.ts#L545-L546
Right now your application goes blank. Nothing happens, no log on console, no exception thrown... Took me a little while to figure it out.
i have same problem, Nothing happens, no log on console, no exception thrown. i don't know how to to next
Hi,
after update to 3.0.5, still nothing happens, no log on console, no exception thrown. i don't know how to do next, The following is the code:
the code is used to load menu items from api server in async setup of "sidenavmenu" sfc
Most helpful comment
I tracked down this issue. When a component with
asyncDepis toggled, the component will be re-mount, which meansregisterDepwill be called. Butsuspensehas been resolved, andpendingBranchisnull, nothing will happen according to the current implementation, so resulting in subsequent errors.This involves some design decisions, I don鈥檛 have the ability to solve it, but I hope this information can save @yyx990803 鈥檚 time